Version Control from the Command Line
What this is. Git records the history of a project as a series of snapshots you choose. This module is not the Git course, which comes next in Foundations. It is about being fluent with the five commands you will type every single working day.
git init starts tracking a directory.
git status says what has changed.
git add file stages a change for the next snapshot.
git commit -m "message" records the snapshot.
git log shows the history.
✦ status is the one to lean on
git status is not a formality, it is the command that tells you what git currently believes about your project. Run it before adding, after adding, and before committing. Almost every confusing git situation is one where somebody stopped checking status and started guessing. It also tells you what to do next, which no other command in this course does.
Staging exists so commits can be deliberate. It seems like an extra step until the first time you have made three unrelated changes and want them in three separate commits. Staging lets you say this part, not that part, which is what makes a history worth reading later.
Mark this lesson complete
Signed in, your progress follows you to every device.