Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitk: weird history tree

Tags:

git

gitk

I'm porting an svn repo to git (using svn2git from https://www.negativetwenty.net/redmine/projects/show/svn2git) and since svn does not track merges, I need to edit .git/info/grafts manually. For this, I launch gitk, search for the term "Merge" in commit messages, verify that the merge commits have the right ancestry and populates .git/info/grafts acordingly.

The issue I'm having is that gitk seems to be confused with the "master" branch. It often shows master being "forked" from a branch and being merged into a branch afterword, when actually it is the opposite.

Why is it unable to understand that master should be "as linear" as possible and it's the branch that should be forked from it, not the opposite? Is it a gitk issue or is the history of the git repo incomplete? It seems "git log --pretty=oneline --graph" is able to show the correct behaviour so I'm thinking it might be a gitk issue.

I also tried giggle and qgit, but both have their problem. I find giggle's tree hard to understand (merges are horizontal for example, while in qgit and gitk they are oblique...) and qgit seems to not show some commits (the commit creating the branch in svn is shown as a git commit in both "git log --pretty=oneline --graph" and gitk, but not in qgit nor giggle).

Note that I use "gitk --all" in my tests.

So my question is: -How can I force gitk to show master as linear as possible? Ideally "left justified" with branches being forked from it, not the opposite. "git log --pretty=oneline --graph" seems to be doing it the right way, but what about gitk?

Thanks!

Edit: Screenshot links are dead. Previously said:

I have uploaded screenshots of the different tools: git log, gitk, giggle, qgit

See how "git log" shows the branch being merged into trunk, while gitk shows trunk being merged in branch. Giggle and qgit shows the right merge, but they often drop some commits (creating branches) so it's really hard to manualy edit the .git/info/grafts file.

like image 462
big_gie Avatar asked Dec 22 '10 16:12

big_gie


1 Answers

See how "git log" shows the branch being merged into trunk, while gitk shows trunk being merged in branch.

That is because gitk freely reorders parents — as do many other tools. The leftmost parent is not always the 1st parent. Often tools put the parents whereever there is space. It ultimately provides for a more packed view. Compare:

  • http://i53.tinypic.com/29lfyti.png - git log makes "master" wind around the "nucrypt2" branch so that the X'th (X>=2) parent is always right of the merge
  • http://i52.tinypic.com/sc7r5v.png - git-forest, default
  • http://i51.tinypic.com/28iatjd.png - same, with merge shortcut seeking disabled

I find git-log's graphing not very ergonomic - it takes more blank lines.

like image 180
user502515 Avatar answered Oct 21 '22 04:10

user502515