I have a svn branch that I had been working on and decided to start using git-svn to work locally. Now I have two problems. I want to move my work into another svn repository (on the same host) but I'd first like to merge the latest work from trunk. How would I do this with git-svn? Also, how would I continue my work in a separate svn-repo while continually merging work from the original repo? Also, I don't want to checkout the entire history from the original trunk because the project is rather huge. I am new to git and to git-svn, though I've taken a crash course in git branching and I feel confident enough to use advanced commands like rebase and cherry-pick. I mainly need to know how to apply these concepts thru git-svn. Do the svn repos get setup as a git remote somehow? Are there good resources on the net explaining how it works? Any guidance is much appreciated.
1 回答
使用
git svn init -s <url>
.git config --edit
,为您的每个 Subversion 存储库添加几个svn-remotes
。稍后您将使用-R
所有 git-svn 命令的选项来选择要使用的选项svn-remote
。根据需要调整
svn-remote
分支映射。请记住,默认refs/remotes/*
命名空间指定远程分支,而不是 Git 远程。(你只有一个git remote
名字.
,我不建议推/拉)。您可以轻松地设计您的远程分支命名空间,以保持来自不同 Subversion 存储库的分支分开(例如
refs/remotes/repoA/*
,/refs/remotes/repoB/*
等)。git svn fetch
. 这具有仅部分扫描历史记录的选项,例如从特定版本开始。请阅读有关如何执行此操作的说明的手册页。您也可以在此处忽略特定路径和/或分支。
像往常一样使用 Git,尽量保持你的提交尽可能线性。经常变基。合并提交很好(
git-svn
甚至会设置svn:mergeinfo
属性),但是圣牛要小心(并阅读手册页以获取警告)。了解带有git-svn-id
标签的 Git 提交是不可变的,push -f
不会拯救你。例如,禁止修改或 rebase 已经dcommit
'ed 的更改。
网上有没有很好的资源来解释它是如何工作的?
到目前为止,最好的资源是联机帮助页。接下来是git-svn
source。