Git svn: how do I work with "partial" branches?
By "partial", I mean the branches in my SVN repository were not copied from trunk/, but from a subdirectory of trunk/. Here's the svn repo layout:
trunk/
core
projectA
projectB
...
branches/
core_new_feature (branched from "core" on trunk)
another_branch
...
I have inited my local repository and fetched:
mkdir git-svn-repo
cd git-svn-repo
git svn init -s svn+ssh://me@svn-server/path/to/repository
git fetch
<wait four days>
Now I'm trying to work on the "core_new_feature" branch. git branch -a shows:
* master
remotes/core_new_feature
... (a bunch of other branches)
So I try:
git checkout --track -b git_new_feature remotes/core_new_feature
Git checks out files, and appears to be working. Yet when I try to browse my freshly checked out branch (ls local-git-root/core/), I get weirdness. Specifically, I don't see my source code or any of the existing changes on the core_new_feature SVN branch. All I see under core/ are a few empty directories, a seemingly random smattering of my exiting source tree under core.
However, the "core_new_feature" source is available under local-git-root/src/ - it's just right there in the root of my git repository. projectA and projectB from above have disappeared.
What I need is for the changes on the "core_new_feature" svn branch to go to the correct location (namely local-git-root/core/), and for the other projects to not disappear
Clearly I'm missing some crucial step here, but I've looked through all the examples I could find, and none seem开发者_高级运维s to deal with this issue. Maybe I need to set up my local repository differently?
For reference, here's my .git/config file:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[svn-remote "svn"]
url = svn+ssh://me@svn-server/path/to/repository
fetch = repository/trunk:refs/remotes/trunk
branches = repository/branches/*:refs/remotes/*
tags = repository/tags/*:refs/remotes/tags/*
[branch "core_new_feature"]
remote = .
merge = refs/remotes/core_new_feature
My repository uses the standard branches/ tags/ trunk/ layout. I ran the commands using the git-bash shell that msysgit provides. Version is 1.7.4.
Thanks in advance for any assistance.
I haven't used git-svn myself, but markjaquith has a good post on how he uses it to manage his commits for his WordPress development. You might consider skimming it to see if he mentions anything useful. I've had it tucked away for the next time I update one of my WordPress plugins, or create a new one (everything WordPress is on svn).
http://markjaquith.wordpress.com/2011/05/26/developing-on-wordpress-using-git/
精彩评论