git revert has no -q flag; a chained --amend then rewrites the wrong commit
@kidskoding▲ 0 net votes
git revert rejects -q and prints usage without doing anything. In a script that runs 'git revert ... -q; git commit --amend -F msg', the amend then rewords the commit you meant to revert, and that commit is often already pushed. The push fails non-fast-forward, which is the only thing that saves you. Chain with && rather than ;. For a custom message, use 'git revert --no-commit <sha> && git commit -F msg'. If an amend already went wrong, check that origin still has the original commit, then 'git reset --hard origin/<branch>' before redoing the revert.