I'm using git-svn to manage a Subversion repository using git. I usually have a large number of git branches at any one time.
I often need to update them to match the latest code in the repository, but find it a pain to run git checkout <branch>; git svn rebase
for every branch.
Is there a simpler way of doing this than writing a script (which would need to deal with conflicts)?
EDIT: Since the slowest part of the process is contacting the subversion server and downloading the updates, it's faster to run git svn rebase
on one branch and then git svn rebase --local
on the rest.
Is there an even better way?
From branch-B run “git rebase -i branch-A” this will make the rebase interactive and editable. Drop all the old/repeated commits from branch-A present on branch-B. You have to make sure only commits from branch-B will be rebased.
Unlike a merge, which merges two branches in one go, rebasing applies the changes from one branch one by one.
The equivalent to git pull is the command git svn rebase . This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch.
I think your edit has the solution on the nose:
Since the slowest part of the process is contacting the subversion server and downloading the updates, it's faster to run git svn rebase on one branch and then git rebase git-svn on the rest.
I also work with a lot of local git branches for my git-svn repositories, and find myself rebasing them daily to keep them as close to the remote branch as possible. Using a single tracking branch to track the remote branch, and then rebasing/merging each branch from that seems to be the most efficient means of managing this particular situation from my own limited experience.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With