0

We have 2 branches. One is live and the other is admin. We just moved to a paid github account and I was working on live.

After git push, when i type "git branch", only live shows up. I don't know why. Mistakenly, i typed "git branch admin" instead of "git checkout admin" and I think this created a clone of the live.

I can't access the admin branch anymore! What should I do?

2
  • You most likely want to delete the admin branch you created by mistake (run git branch -d admin for that), then fetch the admin branch from the remote (run git fetch), then check out the remote-tracking branch as a local branch (run git checkout admin).
    – jub0bs
    Commented Nov 30, 2015 at 18:50
  • Could you kindly post this as answer? It's working now. Thank you so much. Commented Nov 30, 2015 at 19:16

1 Answer 1

1

If a branch admin already existed, then if you had typed

git branch admin

You should get the error:

fatal: A branch named 'admin' already exists.

This suggests that perhaps you never pulled the branch to your machine, or deleted it in some other way. Why not just pull the branch again from GitHub?

git fetch origin admin    
git checkout -b admin origin/admin
2
  • I got this when I do fetch origin admininterface * branch admininterface -> FETCH_HEAD. However, when i do the checkout, it says, "A branch named 'admin' already exists." When i enter git branch, Already on 'admin'. The codes are those of live. What did I missed? Commented Nov 30, 2015 at 19:13
  • 1
    Thanks. I deleted the admin and then use git checkout admin. This pulled the correct one. Thank You :) Commented Nov 30, 2015 at 19:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.