How do I fetch a remote branch?

I deleted my git folder unexpectedly. i was working in remote branch repository. How can i pull my remote branch to my local?


If you still have the git repo:

Just do

git fetch origin

followed by.

git checkout -b <branch> origin/branch

If you've deleted the git repository altogether Then reclone the repository:

git clone <repository-address>

Then, follow the steps above to get other branches if they didn't get pulled in automatically.


I deleted my git folder unexpectedly. i was working in remote branch repository. How can i pull my remote branch to my local?

What to do?

  • Clone the repo again
  • Checkout the desired branches

    # Clone the repo
    git clone <url>
    
    # Checkout the desired branch
    git checkout <branch name>
    
  • If you still have the .git folder and you did not remove it - read how to get your code back here:
    How to move HEAD back to a previous location? (Detached head)

    链接地址: http://www.djcxy.com/p/90494.html

    上一篇: 在GitHub中移动原始目录

    下一篇: 我如何获取远程分支?