6

我有一个 SVN 分支的问题。我用git checkout -t -b stable svn/stable. 然后我做了一个合并git rebase master。之后,我尝试将合并更改提交到远程分支git svn dcommit

但现在看来,Git 将更改推送到主干而不是分支:(

git status告诉我:

# On branch stable
# Your branch and 'svn/stable' have diverged,
# and have 218 and 52 different commit(s) each, respectively.
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
...

有人知道我做错了什么以及如何做对吗?

4

2 回答 2

2

我最近遇到了同样的错误。问题是,当您变基到 master 时,它首先将当前分支硬重置为 master,然后应用合并到它的提交。但是您的主分支与之相关联svn/trunk,因此新重置的分支也与之相关联。所以git-svnon认为当你推送它们时dcommit,提交被“插入”了。svn/trunk

解决方案是使用git merge --no-ff而不是git rebase. 或者使用 Subversion 本身的合并工具。

于 2010-02-17T17:52:13.933 回答
0

现在它起作用了,我这样做了:

   git checkout master
   git svn rebase
   git checkout --track -b svn_stable svn/stable
   git merge --squash master
   git commit -m "Bring stable up-to-date with trunk" 
   git svn dcommit --dry-run
   git svn dcommit

合并比使用冲突处理的 rebase 容易得多。

在这个尝试中我忘了使用--no-ff,这会强制每次合并提交,对吗?

谢谢你的帮助 :)

于 2010-02-18T08:43:08.960 回答