amarillion
amarillion

Reputation: 24917

detect conflicts after git-svn rebase

I'm using so many git-svn repositories (at the same time) that it's becoming a chore to update them all. I'd like to write a script that automates this, so I can just run it every morning while I fetch a coffee.

Basically my workflow is like this

cd ~/module1
git svn fetch
git checkout master
git svn rebase

git checkout topicbranch
git svn rebase

cd ~/module2
git svn fetch
git checkout master
git svn rebase

I've already automated the git svn fetch part, which can be safely done anytime. But it's not so safe to do git svn rebase automatically as there might be conflicts.

How can a script figure out if there was a conflict after a rebase? Then I could run git rebase --abort, and write a line to a log file so I can review the failures when I get back with my coffee :)

Upvotes: 0

Views: 720

Answers (2)

apenwarr
apenwarr

Reputation: 11036

After doing "git svn fetch", you can use a merge instead of a rebase to get the latest svn stuff into your local branch. If the merge is successful, you'll know because there are no conflicts (which you can find with tools like git ls-files). If the merge doesn't work, you haven't mangled anything and can just ignore those toplevel changes to your work tree.

Then do a rebase as a last step before committing (if you want; it's not strictly needed) and you can handle the error-prone rebasing interactively only once.

Upvotes: 3

Bombe
Bombe

Reputation: 83852

From what I can gather from git-svn, git-rebase, and git-sh-setup git will exit with an exit code of 1 if the rebase can not be performed due to conflicts.

Upvotes: 1

Related Questions