Git rollback memo
22 Apr 2019Environment
- OS: Kali linux 2019.1
- Git: 2.20.1
Explanation
How to rollback each procedure of git
Solution
# rollback all unstaged modification
$ git reset --hard
# rollback staged files
# (in repository root directory)
$ git reset .
# rollback newest commit keep files modified and staged
# (go back to when 2nd newest commit happened)
$ git reset --soft HEAD^
# rollback commit and discard its changing
# (go back to when 2nd newest commit happened)
$ git reset --hard HEAD^