Confirmed users
1,643
edits
| Line 329: | Line 329: | ||
Using it while intending to recover files in working directory form a specific revision. Index or branch ref have nothing to do with this usage. | Using it while intending to recover files in working directory form a specific revision. Index or branch ref have nothing to do with this usage. | ||
$ echo "Jerry" > a.txt | |||
$ git add a.txt | |||
$ git commit -m "initial commit" | |||
$ echo "is cool" >> a.txt | |||
$ cat a.txt | |||
Jerry | |||
is cool | |||
# Oops... that is definitely a typo. He is not cool at all. | |||
$ git reset HEAD -- a.txt | |||
$ cat a.txt | |||
Jerry | |||
Now, move forward to checkout command: | |||
$ git checkout -h | $ git checkout -h | ||
usage: git checkout [options] <branch> | usage: git checkout [options] <branch> | ||