svn branching without copying every subdirectory
Our project's trunk looks something like:
trunk/foo
trunk/bar
trunk/baz
The subdirectories foo, bar, and baz are actually unrelated to each other, and bar and baz are actually quite huge. How do I create a branch with just foo, such that my branches would look something like:
branches/branch1/foo
branches/branch2/foo
Right now, what I'm doing is branching the whole trunk, then deleting bar and baz, but I think that would be problematic during the merge since it would try to delete bar and baz. What I'd like is for it to be intelligent enough to know that I just want to work with foo and not do anything with bar or baz.
Secondary question, not as important, what if I want a branch with foo and bar, like:
branches/branch1/foo
branches/branch1/bar
Would the process for branching these two folders without branching the others be harder?
Edit: It's been pointed out to me that I can use svn cp. This works, but I was hoping to work from a git svn repo, and as far as I can tell, the closest analogue git-svn has to svn cp is git svn branch, which automatically handles the copying. Unfortunately, I can't find any option in there that lets me branch just a specific subdirectory.
It is common that one giant svn repository is represented by many git repositories. You should have used git svn init .. -t trunk/foo -b branches/branch1/foo -b branches/branch1/foo
etc. Note: init
, not clone
. Then edit .git/config
:
[svn-remote "foo"]
url = http://server.org/svn
fetch = trunk/foo:refs/remotes/foo/trunk
branches = branches/*/foo:refs/remotes/foo/branches/*
tags = tags/*/foo:refs/remotes/foo/tags/*
Then do git svn fetch
. In addition you could specify --ignore-paths
eg, to ignore docs
directory.
After that git svn branch
should do the right thing. See git-svn manual
.
svn copy will happily operate at any level in the folder structure.
Just do:
svn cp trunk/foo branches/branch1/foo
Think of it like a typical unix filesystem.
You might have to add --parents to the cp line if branch1 doesn't exist yet.
Branching in Subversion is basically just making copies of files (but they aren't really copies since they don't take up any space). So:
svn cp svn://server/repo/trunk/foo svn://server/repo/branches/branch1/foo
You don't need to copy the bar
and baz
directories if you don't want to. Alternately, you can copy everything (since copy is essentially free) and check out only what you need:
svn cp svn://server/repo/trunk svn://server/repo/branches/branch1
svn co svn://server/repo/branches/branch1/foo
链接地址: http://www.djcxy.com/p/7188.html
上一篇: 用git选择提交是什么意思?
下一篇: svn分支而不复制每个子目录