Git origin master does not follow HEAD after commit

时间:2015-06-25 18:17:04

标签: git github

I made a new branch a while back and now my git origin and master don't follow my HEAD.

Before this commit all of the following were on the current commit (HEAD -> BranchName), origin/master, origin/HEAD, origin, master, HEAD but after my commit on HEAD -> BranchName moved to the new commit. How do I resolve this for future commits and link all this together? This causes an issue when I push origin master to my repo because they are still on a previous commit.

1 个答案:

答案 0 :(得分:1)

This is working as expected. When you make a commit locally, only your local branch will advance to the new commit. In your case origin/BranchName is there to mimic what is on the server; since you have not pushed yet, the server does not have your changes. After you do a git push, origin/BranchName will point to the same commit as BranchName.

Note that neither master nor origin/master will move, however, since you are not on that branch. If you want master to have the changes you made, you would need to merge BranchName into master.