Showing posts with label revert. Show all posts
Showing posts with label revert. Show all posts

08 June 2021

How to undo (almost) anything with Git

How to undo (almost) anything with Git


https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/



 

checkout, reset, restore, revert, and switch. What do they really do?

 checkout, reset, restore, revert, and switch. What do they really do?

Written by torek, etc.


https://stackoverflow.com/questions/58003030/what-is-the-git-restore-command-and-what-is-the-difference-between-git-restor


The whole page is useful, especially from 'To add to VonC's answer, and bring into the picture all the relevant commands, in alphabetical order, I will cover:'

I also like -

$git restore -s@ -SW -- <file> 

above the aforesaid section.



07 June 2021

How to undo and redo in git?

 How to undo and redo in git?

For both undo and redo, use git reflog and git reset --hard head@{n}

You will find n in the result of git reflog.