Marcus
Marcus

Reputation: 9472

Git origin master does not follow HEAD after commit

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.

Upvotes: 0

Views: 1733

Answers (1)

David Deutsch
David Deutsch

Reputation: 19015

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.

Upvotes: 2

Related Questions