I'm coding some scripts which execute git-rebase and need to identify when a conflict happene开发者_StackOverflow社区d.
Git-rebase terminates with the same exit status for every error, so I can't use its exit status to detect a conflict. A directory named rebase-apply
is created on conflicts, but it seems that it's an implementation detail which I cannot rely (e.g. in the past the directory had a different name).
Is there a reliable way to detect that git-rebase terminated with a conflict?
Well, I've just realized that I can run git status --porcelain
and check if there is any file with a "U" in its status.
Instead of scripting rebase, script git cherry-pick of all the commits in the range instead. This is what rebase is doing under the hood anyway. If there are conflicts, you can take appropriate action.
Hope this helps
精彩评论