简体   繁体   中英

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 :)

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.

从我可以从git-svngit-rebasegit-sh-setup收集到git-svn ,如果由于冲突而无法执行变基,则git将以退出代码1退出。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM