Git has been around for a while and I had been using scarcely in the past, even I had some code published in GitHub, but when you don't practice, you forget. So I've started small.
I'm working in Windows but I use cygwin to get some Unix-like experience. I installed git in my computer and when I set up my code and initialized a local repository:
A .git folder was created and all my versions would be stored there. I'm not planning on publishing the exercises to any external repository (yet). I created a .gitignore file to exclude from my repository my compilation files. (I struggled without .gitignore in my first repository. Lesson learnt).
Whenever I finished an exercise I would add the code and commit it.
git add .
git commit -m "Exercise 2. Solving the puzzle"
When I want to see which exercises (and commits) I've done so far I do:
git log --oneline
The first think you see the ID of the commit. With it you can retrieve that version, without the risk of losing anything:
git ckeckout 2e81eab
If you want to recover what you were working on:
git checkout master
This way I can review what was studied and modified in every exercise.
If I want to get a list of what files were modified between two exercides I get the commit IDs of the two and I do:
git --no-pager log --name-only --pretty='format:' --full-index 2e81eab..15cf40b
git --no-pager diff 2e81eab..15cf40b pathToFile/theFileName.java
I know these are very basic commands, but they are helping me in my learning process. I've been following the Atlassian Tutorial.