3 ms·
> since you often aren't allowed to rewrite history on the remote For dev branches it's easy, `git reset --hard` on local then `git push -f` again. This comman
by est 4y ago
> since you often aren't allowed to rewrite history on the remote
For dev branches it's easy, `git reset --hard` on local then `git push -f` again. This command combination is not that intuitive for beginners.
I agree this action is sometimes hard to recover e.g. on protected branch, so a warning must be given to the user.
- hoseja 4y agoYou can also `revert` which, while staying in history, needs no warning.
- stephen_g 4y agoAssuming your remote allows you to force push. Also you need to specify where to reset to because 'git reset --hard' will just reset you to HEAD, so you actually need to do 'git reset --hard HEAD~' (usually I don't use --hard for this either because often there's some work I want to keep from the commit).