mkdir gittest cd gittestedit hello.txt
Hello, World!exit
cat hello.txtshould be the same
git init git add . git commit -m "First commit!" git branch update git checkout update cat hello.txtshould be the same
edit hello.txt
Hello, world! Don't leave me!save, exit
git add . git commit -m "Update hello.txt 1"Hmm. I don't like that. I've already committed!
git checkout HEAD~1 -- hello.txtIt's back!
edit hello.txt
Hello, world! I love you!save and exit
git commit -m "Love never dies" git checkout master cat hello.txtIt's gone?
git checkout update cat hello.txtIt's back!
git logI need that entry n commits ago, but just for hello.txt
git checkout HEAD~n -- hello.txt