It's hard to be 100% sure, but this happens often so this is probably the correct answer.
You mention that you have only one branch, named master
. I believe you! But you don't have only one repository—or more precisely, you have your clone, and then there is some other clone, probably on a remote you call origin
on some central server such as GitHub or a corporate server. You send commits to the server, and get commits from the server.
You also mentioned using git commit --amend
. See How does git commit --amend work, exactly? (as in Jubobs' comment) for details, but in short, this doesn't change the commit, it just shoves it aside in favor of the new replacement commit. Presumably, though, you had already pushed the original commit—so now it was in the master
branch in the other repository.
So you now had 0c81926
as the tip of your master
, while they (origin) had c79dc19
. You then made new commit f6429eb
, so that your master
pointed to that.
Then, I bet you ran git pull
(and most likely you have not configured or instructed your git pull
to do git rebase
). This ran git fetch
followed by git merge
. The git fetch
checked with your remote, origin
, and found that its master
pointed to commit c79dc19
. The git merge
that git pull
ran merged their branch with your branch, producing merge commit 706b1ef
.
In the end, what this means is that you did have two different branches: master, and master. It's just that one of them is your master, and one of them is someone else's master.
Note that you can get rid of commit c79dc19
and the merge, e.g., using git rebase -i fe6263e
(the point just before the mess starts): delete the unwanted extra commit, and let git rebase
flatten the remaining history and omit the merge. (Or, use the method in Jeff Puckett II's answer.) Once you do this, though, your history will be divergent from the history on origin
: they have a commit (that same c79dc19
you are trying to get rid of) that you don't. So you won't be able to push without forcing the push (optionally, "force with lease", expecting their master
to be c79dc19
, to make sure they have not gotten even more commits since the last time you checked).