0

I deleted one file after my first commit, and I want to know how can I revert back to that commit state (all files in working dir to that state). Can someone please help me with this?

$ git log
commit 2e8bd07a1f7446d2acef86f854ad57dabe4e5834
Author: Sam <sam@mysite.com>
Date:   Sun Aug 21 00:21:12 2016 +030

    baseline

g@DESKTOP MINGW64 /c/mydir (master)
melpomene
  • 84,125
  • 8
  • 85
  • 148
user2548663
  • 75
  • 1
  • 8

2 Answers2

3

You can use :

$ git log

and then checkout the commit :

$ git checkout 2e8bd07a1f7446d2acef86f854ad57dabe4e5834
chenchuk
  • 5,324
  • 4
  • 34
  • 41
1

You can use git checkout FILE to revert a file in the working directory back to its committed state. This also works for whole directories, so git checkout . will recursively revert all files in the current directory.

melpomene
  • 84,125
  • 8
  • 85
  • 148