1

I'm currently writing trying to write a workflow, that rebases one branch onto another on each push. Now I want that action to fail, if any merge conflicts occur (as there is no way that my code would be able to resolve these).

Is there any flag or other way to make git rebase fail if merge conflicts appear? Can I reproduce this behaviour on another way?

How would I do this for git merge?

3
  • 6
    If there are merge conflicts the rebase will already fail.
    – jonrsharpe
    Commented Mar 10, 2022 at 16:50
  • 2
    In your script, check if the command exit code is 1 Commented Mar 10, 2022 at 17:00
  • Thanks for the input, didn't think the exit code would change if promted to resolve merge conflicts.
    – Jojomatik
    Commented Mar 10, 2022 at 18:37

1 Answer 1

3

Even though it's not obvious from the documentation most git commands fail with exit code 1.

This answer shows this behaviour for git merge, while this one assumes the same bahaviour for git rebase.

Not the answer you're looking for? Browse other questions tagged or ask your own question.