Search code examples
gitgit-svn

How to git svn fetch + rebase in one operation?


I just discovered that even though the rebase section in git help svn says

This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.

(my emphasis) it doesn't mean that rebase includes a git svn fetch. Naming aside, is there some way to run a single git svn command to do both?

The reason I want to do this is that I only write on one branch, so I want to rebase that one and I frequently read other branches, so I want to fetch those.


Solution

  • I'm also a bit surprised to hear that this is actually the way it behaves. But, to answer your question, you just need to define an alias:

    git config --global alias.refetch '!git svn fetch && git svn rebase'

    Then git refetch should do what you want.