Git - How to revert a pushed commit ( Soft + Hard revert examples )

preview_player
Показать описание
How to revert / undo a pushed commit.
2 methods soft and hard:
Soft reverts the changes but keeps the change so you can modify it again.
Hard revert completely reverts it and doesn't keep your changes. Example using Github.

Timeline:
0:00 - Soft revert pushed commit
0:46 - Hard revert pushed commit

Commands:
Hard Revert: git reset --hard HEAD~1
Soft Revert: git reset --soft HEAD~1
Force Push: git push origin -f

With a soft revert, you have a chance to fix up your mistake and push again. But you need to run: git add . && git commit -m "message"
Hard revert removes the change completely, like it never existed.

🎵 Track Info
––––––––––––––––––––––––––––––
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
–––––––––––––––––––––––––––––-
Рекомендации по теме