Git remote tracking branch deviates from local branch with identical commits with different SHAs

Here is my current state of the git repository (as shown in GitX).

Diver git history

"34e ..." and "c3d ..." are written (comments "Implemented global ...") IDENTIFICATION. I confirmed this with git diff, and they even have the same commit moments! The only difference is their SHA.

I have no idea how I got my repo into this state. While I am not git pro, I used it for a while and became very comfortable with all the basic principles. This happened unexpectedly, and I have not experimented with any git features or workflows that I have not used before, so I'm pretty confused.

Nobody gave anything to the remote, so I can change the story there, but a solution not related to this would be better.

I could just perform a normal merge or reinstall of the master and the original / master, but this is inconvenient for me, as the history will show 2 identical commits.

Is it possible to check the origin / master, and then reset all the commits starting with "a4a ..." to the beginning / master, and then switch the master to this new HEAD? (basically leaving "c3d ..." to commit hanging on its own, which does not matter how its cheating)

1) So, what is the preferred way to fix this?
2) Any ideas how this happened? Has anyone else seen this before?

EDIT:
git diff c3db784817 34e1ab666a : doesn't output anything.

git log wizard :

Bender: mt-d-styles tyson $ git master reflog
9579294 master @ {0}: commit: added debug console printing for image verification

1155228 master @ {1}: commit: added a new marker interface that user cells can use a4ab788 master @ {2}: commit: added a new StyledRootElement element that automatically uses the c3db784 application master @ {3}: commit: implemented a global method for styling all existing
34e1ab6 master @ {4}: commit: implemented a global styling method for all existing
8519fb1 master @ {5}: commit: extended deletion method to provide subscribers with access to 30aeee6 master @ {6}: commit: added new method w770> Side Swipe View con

git Creation History / Wizards :

Bender: mt-d-styles tyson $ git story / host reflog
34e1ab6 refs / remotes / origin / master @ {0}: update by clicking

8519fb1 refs / remotes / origin / master @ {1}: update by clicking

495e0ef refs / remotes / origin / master @ {2}: update by clicking

c5fec81 refs / remotes / origin / master @ {3}: update by clicking

cba1e0f refs / remotes / origin / master @ {4}: update by clicking

9ee1ffb refs / remotes / origin / master @ {5}: update by clicking

68ee429 refs / remotes / origin / master @ {6}: update by push
0e2d199 refs / remotes / origin / master @ {7}: update by clicking

8a4de84 refs / remotes / origin / master @ {8}: update by pressing a button

EDIT 2:
git log --format = raw --decorate --graph --all :

* commit c3db7848171f396c5a595a35dd6b609c119f9e84 | tree 998e9749546d05178798c8a462d3eff02a111f4c | parent 8519fb17e77b8ae865e071772ae652316df8822a | author Tyson <tyson> 1364529327 +0800 | committer Tyson <tyson> 1364539365 +0800 | | Implemented a global technique for styling all existing MT.D element backg | | * commit 34e1ab666a81dde7582ee9e31bfa961420d38f55 (origin/master) |/ tree 38f9e0c3d936c702fdcd18d215a2f0a88280893b | parent 8519fb17e77b8ae865e071772ae652316df8822a | author Tyson <tyson> 1364529327 +0800 | committer Tyson <tyson> 1364529327 +0800 | | Implemented a global technique for styling all existing MT.D element bac | 
+4
source share
1 answer

Reason : You probably rewrote the story. If the commits where exactly match, the SHA will automatically be the same. What you see in yourself is not the date of fixation, but the date of the author. Run git log --format=raw --decorate ̵-graph --all to get more details. I think you'll see that the commit date of your local version is a later date. This is caused by rewriting a story, usually changing or recharging.

Solution : If you know how to return, you can just try pulling with rebase - if the commits are really identical, git should implement this and add only one commit. If you don't know how to return, just reformat master to origin/master , cutting into c3db784817:

 git rebase --onto origin/master c3db784817 master 

@ Your question in the comments:

As I know, you fixed from reflog:

 c3db784 master@ {3}: commit: Implemented a global technique for styling all exist 34e1ab6 master@ {4}: commit: Implemented a global technique for styling all exist 

Your main branch was in 34e1ab6 , after you created the commit. Then you clicked that commit. Then your main branch moved to c3db784 - commit with the same message, and your git client says that the reason for this was commit . Since there was no branch branch movement between them, this smells strongly of a fix. The command line client would say commit (amend) though.

And your journal tells me that you made the first commit at unix time 1364529327 (2013-03-28 20:55:27), and then amended unix time 1364539365 (2013-03-28 23: 42:45). (And that you probably live in the USA;)

+6
source

All Articles