How does git svn fetch
work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because git remote
doesn't give me anything on my git svn
repository?

- 2,834
- 15
- 68
- 140
3 Answers
This is how git svn fetch
works:
When using git-svn
you don't have remotes of the svn server as you have when using git, you just have a link to the remote svn server in your local .gitconfig file.
If you want to update your current branch to the last revision you can use git svn rebase
. But if your svn project is big you might be in the situation where you don't know if you the last revision is a successful build. And if you want to update to a specific revision that you're sure is a successful build, for example you use Jenkins which gives you the last successful build, you have to first fetch to the revision you want and then rebase with the fetched commits.
For this you can git svn fetch -r <revision>
. This will fetch locally the commits till the wanted revision. To rebase the fetched data you must use git svn rebase -l
or git svn rebase --local
. You don't have to be online to do a local rebase.

- 2,834
- 15
- 68
- 140
By default the git-svn tracking branch is remotes/git-svn
, you can use it to merge or rebase your work on top of the changes fetched by git svn fetch
.

- 795
- 8
- 20
-
I beg to differ, it seems git-svn generally recreates the branches and tags from the svn repo in git, so you would end up with many branches (potentially) in the gut repo, all tracking in some form the svn branches – user230910 Jun 07 '18 at 04:22
The git-svn tool unfortunately doesn't actually make the remote SVN branches into true Git remotes. They look like remotes but they don't actually function as remotes. git-svn tracks the branches internally and I too have found it a bit frustrating.
You can branch from the SVN branches or merge from them, however. Run git branch -r
to see all your remote tracking branches, including those pseudo-branches created by git-svn:
$ git branch -r
svn/SVNBranch1
svn/SVNBranch2
$ git checkout -b branch1 svn/SVNBranch1

- 11,294
- 5
- 49
- 66
-
`You should be able to branch from the SVN branches or merge from them, however`...How? – Jacob Krieg Jul 03 '13 at 05:59
-
1