Information Technology Reference
In-Depth Information
$ git reflog
The output is presented in Listing 3-10 .
Listing 3-10. The output of git reflog after third revision
fe7dbef HEAD@{0}: commit: dolor
227c9fb HEAD@{1}: commit: ipsum
bb057dd HEAD@{2}: commit (initial): lorem
The history moved forward. This time HEAD@{0} refers to dolor revision. The
previous revision was ipsum , thus it can be referred as HEAD@{1} . The first revision
we created— lorem —is now available as HEAD@{2} .
It's time to use reflog names to restore the revisions. First, we want to restore the re-
vision captioned as lorem . You can do it with the following command:
$ git reset --hard HEAD@{2}
After that, the working directory should contain only one file and the $ git re-
flog command should return the output shown in Listing 3-11 .
Listing 3-11. The output of a git reflog after a git reset --hard HEAD@{2}
bb057dd HEAD@{0}: reset: moving to HEAD@{2}
fe7dbef HEAD@{1}: commit: dolor
227c9fb HEAD@{2}: commit: ipsum
bb057dd HEAD@{3}: commit (initial): lorem
As you can see in Listing 3-11 all the HEAD@{n} references were updated. Here is
what they indicate:
HEAD@{0}—points to the revision lorem
HEAD@{1}—points to the revision dolor
HEAD@{2}—points to the revision ipsum
HEAD@{3}—points to the revision lorem
Next, reset the repository to the revision captioned as dolor with the following
command:
 
 
 
 
Search WWH ::




Custom Search