I know how to create an svn branch w/git. But, can I do that off of a past revision/commit ?
Asked
Active
Viewed 1,446 times
2 Answers
11
Answer for myself (and anyone else) - not strictly git-svn, but it works:
svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch'
# in your git working directory
git svn fetch
git branch -a
You should see remotes/mybranch
in that list, now create a local branch that tracks that remote
git checkout -b local_mybranch remotes/mybranch

EMiller
- 1,138
- 8
- 23
5
You just need to switch to (checkout) that revision first. Here's an example using git-svn only:
git checkout <sha1-of-past-commit>
git svn branch -m "Create branch for v1.2.3 hotfixes" hotfix-1.2.3
git checkout -b hotfix-1.2.3 remotes/hotfix-1.2.3
Tested on Git for Windows 1.9.0.msysgit.0.

Jakub Berezanski
- 1,053
- 9
- 13
-
Just used this method and it worked no problem. Just be aware that if you originally cloned the repo with a --prefix=
option, the remote branch name will be remotes/ – pgraham Sep 11 '15 at 15:46/hotfix-1.2.3