Beginner · 4 min read
The three areas of Git
Working directory, index, repository. Understand this and half your disasters disappear.
Working directory
Your files as you see them in your editor. Git watches them but does not protect them: an untracked change is one bad command away from oblivion.
Safe
$ git status
Index (staging area)
The draft of your next commit. git add copies a snapshot of a file here. From this point, Git can find it again, even if you mess up.
Safe
$ git add -p
Repository
The history of commits. Once committed, your work is very hard to lose for real, thanks to the reflog.
Safe
$ git log --oneline --graph