github 桌面合并提交隐藏评论
github desktop merge commit hiding comments
我们使用 Github Desktop(以前是 Github for Windows)作为我们的 Git 客户端。我们经常遇到以下情况:
开发人员 A 提交了一系列带有可爱解释性消息的更新。
开发者 B 一直在同一个分支工作,然后提交了一条消息。
开发人员 B 的提交和消息显示在 git 日志中,紧随其后,我们从开发人员 B 获得合并提交,并带有一条自动消息 "merge branch ..."。合并提交包含开发人员 A 的所有更改,但开发人员 A 的可爱消息消失了。这种行为似乎有所改变 -- 过去很少发生,现在似乎经常发生。
(很难准确地找到 Github Desktop 中 "Sync" 按钮的最新信息,但我确实发现 a reference 建议它曾经做 git pull --rebase
然后改变了。这似乎符合这个合并提交问题比以前更糟糕的事实。)
所以我的问题是:有什么办法可以防止开发者A的commit message丢失吗?
编辑添加:
似乎问题有两个方面:
1)我们的开发人员并不总是在提交之前进行拉取,从而导致合并提交。原始提交不会丢失,但不可见。
2) Github Desktop 显示日志的方式是显示合并提交但不显示原始提交。这是我在 Github 桌面团队的电子邮件中收到的评论:
Digging into this further, it does look like the commits are being
hidden due to the --first-parent flag that we use when showing the
history in GitHub Desktop. Currently there isn't a way to change this
behavior.
Here's some of the rational behind why we do this that a developer of
GitHub Desktop shared:
"GitHub Desktop is optimized for GitHub Flow. In this model, merges
almost always represent either (1) a branch getting merged into the
default branch via a pull request or (2) a branch being updated from
the default branch.
In the first case, it's most useful to see which pull requests have
been merged—not the individual commits that make up that pull request.
We think pull requests are amazing and very useful for understanding
history, so we want to prioritize them.
In the second case, seeing the commits that came in with a merge only
obscures the changes on the branch. It's most useful to see the
commits that are unique to the branch."
我们最终感觉 Github Desktop 可能不适合我们——我个人已经切换到 GitKraken,我们很多人都在使用命令行 more.
Git merge 不应该这样。如果您不能确定您的 Git GUI 正在执行哪些命令(合并、变基、压缩...),我建议您使用命令行执行 git merge
,这样您就可以控制发生的事情。
我倾向于提倡命令行 Git,因为大多数图形 Git 客户端带来的晦涩和词汇混乱。
开发者A的提交信息应该没有丢失吧。这是 Github 桌面应用程序显示提交的方式。
您可以通过 运行 git log --graph
检查您是否真的丢失了提交。
如果你想要一个显示合并提交的客户端,你可以使用SourceTree or TortoiseGit。
有关详细信息,请参阅 and 。
我们使用 Github Desktop(以前是 Github for Windows)作为我们的 Git 客户端。我们经常遇到以下情况:
开发人员 A 提交了一系列带有可爱解释性消息的更新。 开发者 B 一直在同一个分支工作,然后提交了一条消息。
开发人员 B 的提交和消息显示在 git 日志中,紧随其后,我们从开发人员 B 获得合并提交,并带有一条自动消息 "merge branch ..."。合并提交包含开发人员 A 的所有更改,但开发人员 A 的可爱消息消失了。这种行为似乎有所改变 -- 过去很少发生,现在似乎经常发生。
(很难准确地找到 Github Desktop 中 "Sync" 按钮的最新信息,但我确实发现 a reference 建议它曾经做 git pull --rebase
然后改变了。这似乎符合这个合并提交问题比以前更糟糕的事实。)
所以我的问题是:有什么办法可以防止开发者A的commit message丢失吗?
编辑添加: 似乎问题有两个方面: 1)我们的开发人员并不总是在提交之前进行拉取,从而导致合并提交。原始提交不会丢失,但不可见。 2) Github Desktop 显示日志的方式是显示合并提交但不显示原始提交。这是我在 Github 桌面团队的电子邮件中收到的评论:
Digging into this further, it does look like the commits are being hidden due to the --first-parent flag that we use when showing the history in GitHub Desktop. Currently there isn't a way to change this behavior.
Here's some of the rational behind why we do this that a developer of GitHub Desktop shared:
"GitHub Desktop is optimized for GitHub Flow. In this model, merges almost always represent either (1) a branch getting merged into the default branch via a pull request or (2) a branch being updated from the default branch.
In the first case, it's most useful to see which pull requests have been merged—not the individual commits that make up that pull request. We think pull requests are amazing and very useful for understanding history, so we want to prioritize them.
In the second case, seeing the commits that came in with a merge only obscures the changes on the branch. It's most useful to see the commits that are unique to the branch."
我们最终感觉 Github Desktop 可能不适合我们——我个人已经切换到 GitKraken,我们很多人都在使用命令行 more.
Git merge 不应该这样。如果您不能确定您的 Git GUI 正在执行哪些命令(合并、变基、压缩...),我建议您使用命令行执行 git merge
,这样您就可以控制发生的事情。
我倾向于提倡命令行 Git,因为大多数图形 Git 客户端带来的晦涩和词汇混乱。
开发者A的提交信息应该没有丢失吧。这是 Github 桌面应用程序显示提交的方式。
您可以通过 运行 git log --graph
检查您是否真的丢失了提交。
如果你想要一个显示合并提交的客户端,你可以使用SourceTree or TortoiseGit。
有关详细信息,请参阅