gitk:奇怪的历史树
我正在将 svn 存储库移植到 git (使用 https://www. Negativetwenty 中的 svn2git .net/redmine/projects/show/svn2git)并且由于 svn 不跟踪合并,我需要手动编辑 .git/info/grafts 。为此,我启动 gitk,在提交消息中搜索术语“合并”,验证合并提交是否具有正确的祖先并相应地填充 .git/info/grafts。
我遇到的问题是 gitk 似乎与“master”分支混淆了。它经常显示 master 从一个分支“分叉”并合并到一个分支后记中,而实际上恰恰相反。
为什么它无法理解master应该尽可能“线性”并且应该从它分叉出分支,而不是相反?是 gitk 问题还是 git repo 的历史不完整?似乎“git log --pretty=oneline --graph”能够显示正确的行为,所以我认为这可能是 gitk 问题。
我也尝试过 giggle 和 qgit,但都有各自的问题。我发现 giggle 的树很难理解(例如,合并是水平的,而在 qgit 和 gitk 中它们是倾斜的......)并且 qgit 似乎没有显示一些提交(在 svn 中创建分支的提交在两者中都显示为 git 提交) “git log --pretty=oneline --graph”和 gitk,但不在 qgit 或 giggle 中)。
请注意,我在测试中使用“gitk --all”。
所以我的问题是: -如何强制 gitk 显示 master 尽可能线性?理想情况下,“左对齐”,分支是从中分叉出来的,而不是相反。 “git log --pretty=oneline --graph” 似乎是以正确的方式做的,但是 gitk 呢?
谢谢!
编辑:屏幕截图链接已失效。之前说过:
我已经上传了不同工具的屏幕截图: git 日志、gitk、咯咯、qgit
查看“git log”如何显示分支正在合并到主干中,而 gitk 显示主干正在合并到分支中。 Giggle 和 qgit 显示右侧 合并,但他们经常会删除一些提交(创建分支),所以它是 手动编辑 .git/info/grafts 文件真的很难。
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, qgitSee 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是因为 gitk 可以自由地重新排序父级——就像许多其他工具一样。最左边的父级并不总是第一个父级。通常,工具会将父母放在有空间的地方。它最终提供了更丰富的视图。比较:
我发现 git-log 的图形不太符合人体工程学 - 它需要更多空白行。
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:
I find git-log's graphing not very ergonomic - it takes more blank lines.
使用不同的 GUI 后,该行为似乎确实依赖于工具。可悲的是,其中没有多少是可配置的...
与所有内容都适合的优化视图相比,我更喜欢使用实际发生的树形视图...
我已经选择了“gitg”(http://trac.novowork.com/吉特格/)。看起来相对活跃,而且它的表现也正是我从历史角度所期望的。 Master是最左边的“车道”,分支从它分叉并从右侧合并到它。我觉得这和我的工作流程是一致的。另外,我可以显示“非活动通道”,因此主通道始终显示在最左侧(在首选项窗口中启用/禁用)。
“按拓扑顺序显示历史”也是一件好事。选中后,gitg 将尝试将提交放在一个分支上。未选中时,它们将按时间顺序显示。
它还可以进行基本的提交和暂存。
我能找到的唯一缺点是搜索:似乎我无法输入 sha1sum 并找到正确的提交。也许只是一个错误。
关于最初的问题(可以按照我想要的方式配置 gitk 吗?)我仍然不确定它是否可能。可能是设计决定...
After playing with different GUI, the behaviour really seems to be tool dependent. Saddly, not many of them are configurable...
I prefer having a tree view of what actually happened compared to an optimized view where everything fits...
I have settled for "gitg" (http://trac.novowork.com/gitg/). Seems relatively active, and it does exactly what I expect from the history view. Master is the left most "lane", branches are forked from it and merged into it from the right. I feel it is consistent with my workflow. Also, I can show "inactive lanes" so master is always shown and on the left-most side (enable/disable in preference window).
A nice thing also is the "Show history in topological order". When checked, gitg will try to place commits on a branch together. When unchecked, they will appear in chronological order.
It can also do basic commits and staging.
Only drawback I can find is the search: it seems I cannot enter an sha1sum and find the right commit. Maybe just a bug.
About the original question (can gitk be configured the way I want it?) I'm still not sure it's possible. Probably a design decision...
如果您有 github 帐户,您可以尝试“网络”也有这样的看法。
If you have a github account, you could try the "Network" view on there too.