Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?

后端 未结 5 2149
野的像风
野的像风 2020-12-13 23:54

I\'m trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.

Is there a way to determine if a rebase w

5条回答
  •  爱一瞬间的悲伤
    2020-12-14 00:17

    At the time of writing (Git v2.6.1 v2.10.0), the git rebase command offers no --dry-run option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts.

    However, if you run git rebase and hit a conflict, the process will stop and exit with a nonzero status. What you could do is check the exit status of the rebase operation, and, if it is nonzero, run git rebase --abort to cancel the rebase:

    git rebase ... || git rebase --abort
    

提交回复
热议问题