Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run git svn rebase on all branches

Tags:

git

svn

git-svn

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?

like image 525
Tim Bellis Avatar asked Nov 28 '12 14:11

Tim Bellis


People also ask

How do I rebase all branches?

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.

Does git rebase change both branches?

Unlike a merge, which merges two branches in one go, rebasing applies the changes from one branch one by one.

What is git SVN rebase?

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.


1 Answers

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.

like image 147
Peter Bratton Avatar answered Oct 08 '22 02:10

Peter Bratton