-2

I'm a student trying to learn the basics of git. I've looked on-line for tutorials but they usually are a little too advanced for what I want to use git for. All I want is a local git repository that tracks the previous versions of my work.

So I understand the basics of git init, git add and git commit but how can I access older versions of a file? Git log shows a list of previous commits but how do I use this to retrieve older versions? For example I would like something like

git get commit c6af7ed0e10be25f4cc274989f1c556c1fefcc7f

also what command is required to tell git to record changes to a file? Must I run git commit every time I want git to record changes to the files being tracked?

Gottfried
  • 2,019
  • 3
  • 15
  • 16
  • 2
    What's wrong with http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide?rq=1 ? – John WH Smith Apr 05 '14 at 14:33
  • 1
    if all you want is that, you might be better off with dropbox, google drive or similar, not with a full version control system like git. – eis Apr 05 '14 at 15:08

1 Answers1

1

how can I access older versions of a file? Git log shows a list of previous commits but how do I use this to retrieve older versions?

Do

git checkout c6af7ed0e10be25f4cc274989f1c556c1fefcc7f

You can of course use other commit hashes to checkout other commits.

Must I run git commit every time I want git to record changes to the files being tracked?

Short answer: yes

Tim
  • 41,901
  • 18
  • 127
  • 145