Chapter 6Tracking Changes

In the last chapter, you learned how to get your content into Git and how to move it through the different levels (working directory, staging area, local repository). Because you can have different versions of files at the different levels in Git, you need a way to keep track of where everything is and how the versions at the different levels may differ from each other. In short, you need easy ways to keep track of all of your work that's in progress. Git has two commands that can help you with this: status and diff. Using these two commands allows users to quickly understand the state of their changes in the local environment and to ensure that the correct changes are tracked and stored in Git.

GIT STATUS

As the name implies, the git status command provides status information on changes in the local environment that have not been committed yet. Let's start with a quick look at the general form of the command.

git status [<options>…] [--] [<pathspec>…]

Like other commands, this command can take path specifications, but those are not required. The “--” is a separator used to note where options end and path specifications start. It sits in between and is not required if the specifications are unambiguous enough.

Get Professional Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.