1

I created a branch named "javascript-checkpoint". Then I pushed that branch to GitHub.

Then I locally changed the name of "javascript-checkpoint" to "explore-checkpoints".

Then I did git push, thinking that would make it so that GitHub would show explore-checkpoints in place of javascript-checkpoint. But GitHub showed no branch named explore-checkpoints, only javascript-checkpoint. I then did 'git push origin explore-checkpoints', and git told me: * [new branch] explore-checkpoints -> explore-checkpoints So the branch was not on GitHub until I pushed it as a new branch. Now GitHub is showing javascript-checkpoint and explore-checkpoints as two separate branches. Locally, I have only explore-checkpoints. How do I make GitHub show the same?

I found a similar question ( Rename remote branch ) but the asker of that one is more concerned than I am with making it so others can still pull from his repository. I only care about making it so one other person can look at my code. I am the only person who edits code in this repository.

Community
  • 1
  • 1
Coleman
  • 565
  • 7
  • 15

2 Answers2

2

Is there any particular reason why simply deleting the "javascript-checkpoint" branch isn't an option?

If you want to just delete the extra branch, simply run git push origin :javascript-checkpoint to delete the remote branch.

Shauna
  • 9,495
  • 2
  • 37
  • 54
  • I thought the explore-checkpoints branch on GitHub did not include commits I made on javascript-checkpoint. Now I see that it does. Which I should have checked earlier by looking at explore-checkpoints on GitHub. Thanks. – Coleman Nov 27 '12 at 22:54
  • 1
    @Coleman remember that a `git` branch is just a label we put to a commit. – mgarciaisaia Nov 28 '12 at 00:48
1

You can simply delete your previous remote branch

git push :javascript-checkpoint

Your first push was still using the remote tracking branch used the first time:

git push  explore-checkpoint:javascript-checkpoint

Which is why you didn't see a second branch right away.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Note that with a recent git1.7.11+ Git, the push policy changes by default: http://stackoverflow.com/a/9749477/6309 – VonC Nov 27 '12 at 21:59
  • What does your second command mean (git push explore-checkpoint:javascript-checkpoint)? – Coleman Nov 27 '12 at 22:59
  • 1
    @Coleman it is how your git push was translated after renaming your branch locally : the associated upstream branch was still there, with its original name. – VonC Nov 28 '12 at 04:45