git 指出分支在变基后未合并 - 为什么?

发布于 2024-10-26 02:59:05 字数 498 浏览 5 评论 0原文

我正在使用 git-svn 来管理我的错误修复分支,但它告诉我,我有未合并的更改,即使我直接查看 SVN 存储库,我也可以看到它们也已提交。这就像错误修复的变基没有将分支设置为合并。

我在这里做错了什么?

git checkout -b fix_bug_1234

git add .
git commit -m "first change"
git add .
git commit -m "second change"

git rebase -i HEAD~2 // squash the two changes together

git svn rebase // fetch any changes from svn

git checkout master
git rebase fix_bug_1234
git svn dcommit

git branch -d fix_bug_1234
error: The branch 'fix_bug_1234' is not fully merged.

I'm using git-svn to manage my bugfix branches, but it tells me that I have unmerged changes, even though if I review the SVN repo directly, I can see they have been committed too. It's like the rebase of the bug fix is not setting the branch as merged.

What am I doing wrong, here?

git checkout -b fix_bug_1234

git add .
git commit -m "first change"
git add .
git commit -m "second change"

git rebase -i HEAD~2 // squash the two changes together

git svn rebase // fetch any changes from svn

git checkout master
git rebase fix_bug_1234
git svn dcommit

git branch -d fix_bug_1234
error: The branch 'fix_bug_1234' is not fully merged.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

摇划花蜜的午后 2024-11-02 02:59:05

原因是 git rebase 更改了提交对象。因此,虽然实际内容(或差异)与那些重新基准的提交相同,但它们指的是不同的父级,因此是不同的。

这样 gitbranch -d 就无法验证这些提交的更改是否包含在其他一些提交中。然后您需要使用 gitbranch -D(大写的D)来强制删除。

附带说明: git svn dcommit 与 rebasing 具有相同的效果。当 dcommit 将提交推送到 SVN 服务器时,它随后再次从 SVN 服务器获取提交。因此,您最终得到的对象与您推送的对象不同。尽管它们的内容可能相同(除非有冲突),但它们仍然不同(主要原因是 git svn 在提交消息中添加了一行,说明提交所属的 SVN 版本)。

The reason for that is that git rebase changes the commit objects. So while the actual content (or diff) is the same with those rebased commits, they are referring to a different parent, and as such are different.

That way git branch -d cannot verify that the changes of those commits are included in some other commits. You need to use git branch -D (uppercase D) to force the deletion then.

On a side note: git svn dcommit has the same effect as rebasing. As dcommit pushes the commits to the SVN server, it afterwards gets the commits from the SVN server again. So you end up with different objects than the ones you pushed. Although they may be identical in content (unless you had conflicts), they still differ (main reason is that git svn adds a line to the commit message stating the SVN version the commit belongs to).

颜漓半夏 2024-11-02 02:59:05

这就是我做这类事情的方法,而且它有效。用户 poke 的答案解释了为什么 git rebase 没有做你想要的事情。

git rebase -i HEAD~2 // squash the two changes together

git svn rebase // fetch any changes from svn
git svn dcommit  // you can commit to SVN from any branch

git checkout master
git svn rebase
git branch -d fix_bug_1234

Here is how I do this sort of thing, and it works. The answer from user poke explains why the git rebase is not doing what you want it to.

git rebase -i HEAD~2 // squash the two changes together

git svn rebase // fetch any changes from svn
git svn dcommit  // you can commit to SVN from any branch

git checkout master
git svn rebase
git branch -d fix_bug_1234
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文