Get Old Version Of Files

Get Previous Version

Let's say we've made a commit a few days and we've since made many more commits. However, what if we'd like to get the version that we had a few days ago. We could use git log to look up the commit id. The commit id can then be used to checkout out the specific file from the given commit. Note: we don't need to use the full ID, 15 or so digit should be uinquie enough for git to figure it out.
Once we checkout the file, it will be placed on the index(staged). Ready to be committed.
#a8d323ab32da324 is the ID of the commit from which to get the file.
#the commit ID does not have to be the full ID.
#git will get the version from the given commit and stage it for us.
git checkout a8d323ab32da324 -- resources.html
Cookbook Category: 

Add new comment