Can git revert be dried?

I need to return the commit, but only if there are no conflicts. Something like git revert --only-if-no-conflicts, but there is no such option, and no --dry-run( --no-commitit will still affect the working copy, which I need to avoid).

In this case, the return is executed from the script, so I can not manually check whether there were conflicts or not. I can do it somehow from a script, but before diving into it, is there any clever way to make Git return only if it succeeds without conflict?

+3
source share
1 answer

The script should:

Separate, discard, observe.

, git-new-workdir, , /tmp.

,

new branch $ git revert --no-edit ce6982e || \
                 { export REVERT_FAILED=yes; git revert --abort; }

, , .

+2

All Articles