Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why GitKraken graph is not showing commits of same branch in chronological order?

This is weird to my understanding and I am sure I am missing something here...

Also, GitKraken is splitting/showing commits of same branch as 2 different branches.

Here an example:

Note: numbers represents chronological order when commits were created. All commits in below picture are from master branch. Commit 7 parent is commit 6.

enter image description here

  1. Why GitKraken moved commits 5 and 6?
  2. Why GitKraken splits commits of same branch in two different "branches"? (actually only one exists, master)

In GitHub and gitk I see only one branch with all commits in chronological order.

Edit with gitk --all: (sorry for trimming message info). As I said, in github commits also are shown in chronological "expected" order.

enter image description here

like image 410
cjuroz Avatar asked Aug 27 '18 06:08

cjuroz


2 Answers

I asked GitKraken support about this a while ago. Their response:

The graph behavior you noted below is a known issue that is currently with our team for review. GitKraken only looks at the commit timestamp when drawing the graph, so when those commits are not in chronological order, the result is the orphaned commit seemingly on a separate branch. I'll give that existing item a +1 to note your additional interest in a fix for that issue.

like image 170
Jorn Avatar answered Oct 04 '22 19:10

Jorn


From what I can tell if your dates seem chronological in GitKraken and you're still getting this it's because GitKraken only displays the author date while using the committer date to sort the commits, meaning the two of em have somehow gotten out of sync.

You could, of course, fix this with an interactive rebase but that'll flatten any development branches you have down the line from the issue, definitely not ideal. The far better solution seems to be to run the following:

git filter-branch --env-filter "export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"" -- --all

[taken from jphx, I just swapped out the quotes to get it to work across more shells]

Good luck!

like image 36
Fraser Avatar answered Oct 04 '22 21:10

Fraser