gpt4 book ai didi

github桌面 merge 提交 stash 评论

转载 作者:太空狗 更新时间:2023-10-29 14:44:31 25 4
gpt4 key购买 nike

我们使用 Github Desktop(以前称为 Github for Windows)作为我们的 Git 客户端。我们经常会遇到以下情况:

开发人员 A 提交了一系列带有可爱解释性消息的更新。开发者 B 一直在同一个分支上工作,然后提交了一条消息。

开发人员 B 的提交和消息显示在 git 日志中,紧随其后,我们从开发人员 B 获得 merge 提交,并带有自动消息“merge branch ...”。 merge 提交包含开发人员 A 的所有更改,但开发人员 A 的可爱消息消失了。这种行为似乎已经发生了一些变化——过去很少发生,现在似乎一直都在发生。

(很难准确地找到关于 Github Desktop 中“同步”按钮功能的最新信息,但我确实找到了 a reference 表明它曾经用于 git pull --rebase 然后更改。这似乎符合这个 merge 提交问题比以前严重得多的事实。)

所以我的问题是:有什么方法可以防止开发者A的提交信息丢失吗?

编辑添加:似乎问题有两个方面:1)我们的开发人员并不总是在提交之前进行 pull ,从而导致 merge 提交。原始提交不会丢失,但不可见。2) Github Desktop 显示日志的方式是显示 merge 提交但不显示原始提交。这是我在 Github Desktop 团队的电子邮件中收到的评论:

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,我们中的很多人更多地使用命令行。

最佳答案

Git merge 不应该那样。如果您不能确定您的 Git GUI 正在执行哪些命令( merge 、 rebase 、压缩等),我建议您使用命令行执行 git merge,这样您就可以控制发生的事情。

我倾向于提倡命令行 Git,因为大多数图形化 Git 客户端带来的晦涩和词汇困惑。

关于github桌面 merge 提交 stash 评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36200919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com