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
If you just want to see if the rebase would be successful but then you want to "roll back," you can alway reposition the branch tip back to the original commit. Just tag or make a note of the original SHA.
Or perhaps easier, create a new temporary branch in which to "stage" the rebase:
git checkout your-branch
git checkout -b tmp
git rebase other-branch
If it was successful but you want to "roll back," your-branch is untouched. Just git branch -D tmp and you're back to where you started from.
If there were conflicts and you did some work to resolve them and you now you want to keep the rebase, just reposition your-branch tip to tmp (and then git branch -D tmp).