gpt4 book ai didi

git - 对于已经在 repo 中的提交, "commits with"是如何发生的?

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

我在几个项目中看到过这种情况。我认为当另一个人的提交被添加到另一个作者的分支剪切时,Github 会用“提交”来做大图/小图。在这种情况下,可以通过将 develop 分支 merge 到功能分支来完成。

在 pull 请求/功能分支中: enter image description here

已经在 develop 分支中: enter image description here

我查看了 d6796688317e24 的差异是相同的,但是没有 merge 冲突,所以 pull request 仍然可以 merge 。我认为这是可能的,因为 PR 也有可能解决自冲突提交的 merge 提交,但我真的很想知道 pull 请求创建者首先做了什么来让这发生。

我解决这个问题的建议是从 develop 中切出一个新分支,然后从功能分支中挑选更改到新分支中(只有少数)。我更想知道是什么导致这些重复提交出现在 pull 请求/其他开发人员的功能分支中。

最佳答案

when commits by another one are added to a branch cut by another author

这是错误的。提交不会被另一位作者“削减”,没有作者与分支相关联。它们是指向提交的临时指针,仅此而已。

Git 向您展示了作者和提交者是不同的人。每个提交都有 an author and a committer .他们通常是同一个人,但当他们不同时,Github 会以画中画的方式展示他们。

如果您定期看到这种情况,很可能是因为有人正在 rebase 其他人的提交。

looked and the diffs for d679668 and 8317e24 are identical, but there is no merge conflict, so the pull request can still be merged.

当引入的更改相同时,不存在冲突。

My suggestion for resolving this issue would just be to cut a new branch from develop and cherry pick the changes from the feature branch into the new branch

这是一个解决方案。您还可以要求开发人员向 git fetch 发出 pull 请求然后 git rebase -i origin/<target branch> ,并仅手动选择他创作并有兴趣 merge 的提交。

I'm more interested to know what could have caused these duplicate commits to appear in the pull request / other dev's feature branch.

在某个时间点,作者在他的功能分支上完成了这些提交。也许他从不同的分支 merge 了它们,或者他的分支基于 origin/develop而他的本地develop在后面。无论如何,他可能将他的功能分支重新定位在 develop 上。在发出 pull 请求之前,没有仔细查看他拖延了哪些提交,结果除了自己的提交之外还重新设置了其他人的提交。

关于git - 对于已经在 repo 中的提交, "commits with"是如何发生的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37029371/

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