The Problem Git Solves
What this is. Before version control, keeping history meant copying folders.
`
portfolio
portfolio-backup
portfolio-backup-2
portfolio-FINAL
portfolio-FINAL-actually
`
You have almost certainly done some version of this. It works until you need to answer a question about it, and then it fails completely.
The questions a folder of copies cannot answer.
What changed between these two versions, and why.
Who made this change.
Which version was working before I broke it.
Can I try something risky without endangering what already works.
Can two people work on this at once.
Git answers all five, and that is the actual reason it exists. It is not a backup system. It is a record of decisions.
✦ A commit is a sentence, not a save
The habit that makes git valuable is writing commits that explain WHY. Six months later, updated files tells you nothing you could not see from the diff. Fix search returning results in the wrong order tells you what problem existed and that it is now solved. Your commit history is documentation that writes itself, but only if you write it.
Three places a file can be. This is the model that makes everything else make sense.
The working directory is what is on disk right now.
The staging area is what you have marked for the next snapshot.
The repository is the recorded history.
A change moves working, then staged, then committed. Nearly every git command is about moving between those three.
Mark this lesson complete
Signed in, your progress follows you to every device.