I deleted my git folder unexpectedly. i was working in remote branch repository. How can i pull my remote branch to my local?
Asked
Active
Viewed 1.1k times
-3
-
What does ‘*remote branch repository*’ mean? If you deleted `.git` you can use `git init` and `git remote add`. If you deleted the whole repo, just clone again. – Biffen Feb 11 '16 at 13:40
-
Possible duplicate of [Clone all remote branches with Git?](http://stackoverflow.com/questions/67699/clone-all-remote-branches-with-git) – dkinzer Feb 11 '16 at 13:45
-
@dkinzer I think you might have misunderstood. Read the first sentence of the question again. – Biffen Feb 11 '16 at 13:46
-
@Biffen: ...hmm, it's still a duplicate imho: http://stackoverflow.com/q/651038/256854 – dkinzer Feb 11 '16 at 13:54
-
@dkinzer *Maybe* of that second one. The question is too unclear to know. – Biffen Feb 11 '16 at 13:56
4 Answers
6
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.

dkinzer
- 32,179
- 12
- 66
- 85
0
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)

Community
- 1
- 1

CodeWizard
- 128,036
- 21
- 144
- 167