filmov
tv
Git How To Undo Last Commit Before Push (git reset soft git reset hard)

Показать описание
(We're free online community, meet other makers!)
#git #github #webdevelopment
In git how to undo most recent commit and go back to last commit before push? You can undo last commit with git reset command. You can choose whether to do a HARD or a SOFT undo. Hard will remove your changes too. SOFT will keep the latest changes.
git reset --hard HEAD^
git reset --soft HEAD^
00:00 How to git undo last commit
00:07 Let's open VSCode and Command Line (cmd, bash, terminal)
00:33 Let's break our commit with some faulty code
00:42 How to stage our changes on git
00:51 How to commit our broken code using git
01:20 Using git log command to see most recent commit
01:34 undo last commit using git reset hard head (and caret character)
02:20 Hit enter to undo last commit (the hard way)
03:05 Breaking the code again to demonstrate git soft reset (keep the changes)
03:41 git reset soft head^
03:55 git reset hard head^ (undo to most recent commit again)
#git #github #webdevelopment
In git how to undo most recent commit and go back to last commit before push? You can undo last commit with git reset command. You can choose whether to do a HARD or a SOFT undo. Hard will remove your changes too. SOFT will keep the latest changes.
git reset --hard HEAD^
git reset --soft HEAD^
00:00 How to git undo last commit
00:07 Let's open VSCode and Command Line (cmd, bash, terminal)
00:33 Let's break our commit with some faulty code
00:42 How to stage our changes on git
00:51 How to commit our broken code using git
01:20 Using git log command to see most recent commit
01:34 undo last commit using git reset hard head (and caret character)
02:20 Hit enter to undo last commit (the hard way)
03:05 Breaking the code again to demonstrate git soft reset (keep the changes)
03:41 git reset soft head^
03:55 git reset hard head^ (undo to most recent commit again)