Information Technology Reference
In-Depth Information
It means that there are two changes in the working directory:
• The file stephen-king.txt was modified.
• The working directory contains one new file graham-master-
ton.txt .
Print the history with $ git l alias.
The output contains the three revisions we created in Recipe 3-1:
ffa6 Third revision [Stephen King]
0468 Second revision: [John Grisham]
de36 First commit [Agatha Christie]
Suppose that right now you forget to commit your work. Both files stephen-
king.txt and graham-masterton.txt remain uncommitted while you decided
to restore your very first revision with:
$ git reset --hard de36
After that command the working directory contains two files. The command $ ls
prints their names:
agatha-christie.txt
graham-masterton.txt
The file stephen-king.txt has disappeared. You can reset the state of the re-
pository to the revision:
ffa6 Third revision [Stephen King]
It can be done with the reflog:
$ git reset --hard HEAD@{1}
The file stephen-king.txt will be restored, but it will now contain only the
three topics typed during Recipe 3-1. The command:
$ cat stephen-king.txt
Search WWH ::




Custom Search