git-svn branch - How to keep branch in sync with trunk?

大憨熊 提交于 2019-12-06 00:15:24

I don't really understand how this simple question was left unanswered for more than a week, with only 13 views so far. I guess it was my fault, bad question writing.

Anyway, I figured it out myself. Short version: just use git merge instead of git rebase.

My confusion came from using git rebase when syncing a branch with the changes in master. When working on local branches, this usually works great, and keeps the history clean. However, you should not rebase commits that you have pushed to a public repository, and the subversion repository is (apparenly) public enough. git merge, on the other hand, works beautifully, and doesn't have any problem.

So, the long answer is: when you want to merge the latest changes in the trunk into the svn branch you're tracking, just do:

git merge master
# Handle conflicts, git add when you're done
git commit
git svn dcommit

This will keep your branch in sync with trunk, but will not set mergeinfo, so you probably should not mix svn merge with this kind of practice.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!