First, never use --force, but use --force-with-lease -- this will fail to push in case someone make remote changes. Useful if you are collaborating on branches (or develop from more than 1 computers).<p>> It can't pause when a conflict occurs, so you have to fix the conflict and (somehow) re-run it from the point it stopped at, which is fiddly at best.<p>There is better way:
1. I use `git rebase -i` from the top of the stack -- it opens a vim with list of changes it's going to do.
2. I have script (<a href="https://github.com/mic47/git-tools/blob/master/GitStackTodo.hs" rel="nofollow">https://github.com/mic47/git-tools/blob/master/GitStackTodo....</a> ) that process this and inserts commands to backup branch and move branch to new location to TODO list. At this point, I can even modify the TODO list to rip out commits I don't want, or squash commits i want. Or you can reorder commits (I usually do code review fix at top of the stack and then reorder commits -- at least if I am reasonably sure there won't be conflicts for this fixes).
3. At this point, you can insert more things, like run tests after each branch, or commit (and pause rebase in case of failure, so you can fix it).
4. When I close this file, rebase starts. In case of conflict, rebase pauses, let you fix it, and when you continue rebase, it will finish the TODO file.
5. After, I have script that removes backup branches.
6. I have script that runs command on each branch, so at the end, I do this to push my changes `git stack-foreach master git push --force-with-lease `<p>What if you can't resolve conflict and you are in the middle of the rebase? You can run `git rebase --abort` and it will restore top of your commit. Only drawback is that branches that were rebased are not restored, but hence my script also create backup branches so I can fix that manually and move branches back.