-2

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

5
  • 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. Commented Feb 11, 2016 at 13:40
  • Possible duplicate of Clone all remote branches with Git? Commented Feb 11, 2016 at 13:45
  • @dkinzer I think you might have misunderstood. Read the first sentence of the question again. Commented Feb 11, 2016 at 13:46
  • @Biffen: ...hmm, it's still a duplicate imho: stackoverflow.com/q/651038/256854 Commented Feb 11, 2016 at 13:54
  • @dkinzer Maybe of that second one. The question is too unclear to know. Commented Feb 11, 2016 at 13:56

4 Answers 4

9

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.

Sign up to request clarification or add additional context in comments.

Comments

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?

  1. Clone the repo again
  2. 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)

Comments

0
git checkout -b branch_name git pull URL branch_name 

Comments

0
git clone -b <branch_name> <url> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.