[英]Git: How to commit into SVN branch after rebase?
我有一個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)
...
有人知道我做錯了什么,怎么做對了?
我最近遇到了同樣的錯誤。 當你重新掌握它時,它首先將當前分支硬重置為master,然后應用提交合並到它。 但是你的主分支與svn/trunk
相關聯,因此新重置的分支也與它相關聯。 所以dcommit
上的git-svn
認為當你推送它們時,提交被“插入”到svn/trunk
。
解決方案是使用git merge --no-ff
而不是git rebase
。 或者使用Subversion本身的合並功能。
現在它可以工作,我這樣做:
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
合並比沖突處理更容易。
在這個嘗試中我忘了使用--no-ff
,這會強制每次合並提交,對吧?
謝謝你的幫助 :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.