-1

I am new to GIT. Please help me, I am stuck at this point.

In my Remote Repository (github.com), already a branch by name code-267 is present which was created by a different developer.

My requirement: I need to check in that branch into my Eclipse.

Please tell me if can I execute the below statement, so that I will code of branch code-267 ??

git checkout --track -b code-267 origin/code-267

Please let me know, thanks in advance.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Pawan
  • 31,545
  • 102
  • 256
  • 434
  • 2
    Command seems to be ok - why don't you just try it? – 1615903 Apr 29 '13 at 10:31
  • dont know if it deletes the existing branch ?? and creates a new one . – Pawan Apr 29 '13 at 10:43
  • @PreethiJain If you already have a branch named `code-267` on your computer and it does not track the remote one, you can move it to some other name using `git branch -m `. Otherwise checking out the remote branch will not delete anything. – Dmytro Sirenko Apr 29 '13 at 10:46

1 Answers1

3

Actually:

git fetch # Get all updates and branches
git checkout code-267

will work fine.
Branch are deleted with the -D flag so as long as you do NOT use that you will not delete anything and you will be OK. If you did delete a branch by mistake you would still be OK as long as you didn't push that change to github.

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497