Information Technology Reference
In-Depth Information
Problem
As you may remember, git is a version control system. That means it stores all versions
of the files in your project. You may wonder how can you access versions that were
stored some time ago? You want to restore your project to the very first revision, then
to a revision that was committed some time ago, and finally to the very last revision.
Solution
Clone the repository from Recipe 3-4:
$ cd git-recipes
$ git clone 03-04 03-05
$ cd 03-05
and print the history with $ git l . The output will be similar to Listing 3-6 . Save the
output of $ git l for future reference to use with this recipe. I will refer to Listing
3-6 but because you have different SHA-1 hashes you will need your own copy of the
history. Once you learn how to work with reflog, saving will become unnecessary. You
will learn how to use reflog in Recipe 3-8.
Listing 3-6. The history of repository used in Recipe 3-5
abda Mapping names with .mailmap
ba80 [FR] Frere Jacques
659c [EN] Little skylark, lovely little skylark
348f [FR] Alouette, gentille alouette
39d6 Titles
d234 [PL] Bajka iskierki
f305 Internationalization: directory EN
564f Baa, baa black sheep
7cfb Sing a song of sixpence
Now, restore the working directory to the very first revision named 7cfb :
$ git reset --hard 7cfb
 
 
Search WWH ::




Custom Search