Your daily Git workflow

Check the repository status

Use git status before and after every important operation to see what Git knows about your files.

git status is the command that keeps you oriented.

Run it before and after an operation:

git status

Git compares three states: HEAD, the staging area, and the working tree.

It reports changes in useful groups:

  • Changes to be committed are in the staging area.
  • Changes not staged for commit exist only in the working tree.
  • Untracked files are in the working tree but not in HEAD or the index.

Status also shows the current branch. When a branch tracks a remote branch, it can show whether your local reference is ahead or behind the last fetched remote-tracking reference.

Status does not show line diffs

Notice that git status does not show every changed line. Use git diff for that.

My advice is to run git status often. It is the safest way to stay oriented before you stage, commit, merge, or switch branches.

If you see both modified on a file during a merge, status is telling you the conflict still needs a human decision. Do not commit until those paths disappear from the unmerged list.

You can use the shorter format once you understand the full one:

git status --short

In short format, M in the first column means staged changes. M in the second column means unstaged working-tree changes. ?? marks an untracked file.

A file can show MM when it has both staged and unstaged edits. That is the same situation you saw with git diff and git diff --staged showing different content.

Try this on your own project: create one untracked file, modify one tracked file, and stage a third file. Run both status formats and identify where each change currently lives.

Lesson completed