Proficiency in Git part 7

1 minutes read

Revert all file changes of a commit

Use the Git log to view the commit history:

$ git log
commit 50ef5484c2b98d06600f75b819105dc9b4cefa6b (HEAD -> source)
Author: namtruongdev <namtruongdev@gmail.com>
Date:   Sun Jan 26 21:53:28 2020 -0500

    update

commit 7d6fe403d0ec58ed1add3076bb7f9197717c27ca
Author: namtruongdev <namtruongdev@gmail.com>
Date:   Sun Jan 26 09:57:42 2020 -0500

Finally, we will retrieve the commit you want to revert and issue the command git revert:

$ git revert 50ef5484c2b98d06600f75b819105dc9b4cefa6b

All changes to the files of the above commit will be reverted back to the original file.

Limit git revert as much as possible.


Categories: Learn programming

Keywords: Git
Comments