Last Updated: January 3, 2026
Understanding the state of your repository is essential for working effectively with Git.
The git status command shows you exactly what’s going on in your working directory and staging area: which files are untracked, which are modified, and which are ready to be committed.
In this chapter, we’ll break down how to read git status output and use it as your primary guide while you work.
git status DoesAt its core, git status provides a summary of your current repository state. It tells you which files have been modified, added, or deleted, and it distinguishes between files that are staged for commit and those that are still in your working directory.
This clarity is vital, especially in larger projects where multiple files and changes can create confusion.
When you run git status, Git examines three main areas:
The command will output messages indicating the state of these areas, helping you understand what actions you need to take next.
The output of git status can seem cryptic at first, but it provides valuable information.
Understanding these sections helps you make informed decisions on whether to stage changes, commit them, or address untracked files.
The git status command is invaluable in numerous real-world scenarios. Let’s explore some typical use cases.
Imagine you’ve been working on multiple files. Before committing, running git status can help you verify that you are including the correct changes.
This output confirms that both fileA.txt and fileB.txt are staged for commit. You can now safely proceed to commit, knowing these are the changes you intended to include.
After performing a merge, it’s critical to review your repository’s state. Merge conflicts can arise, and git status will inform you of any files that need your attention.
In this case, git status indicates that conflicting-file.txt requires resolution before you can proceed. This gives you the direction needed to address conflicts efficiently.
When you create new files, they often remain untracked until you decide to add them. Running git status frequently helps you manage these files, ensuring nothing important goes unnoticed.
Here, you see newFile.txt is untracked. If this file is important for your project, you can add it to the staging area immediately.
While git status is straightforward, understanding its nuances can enhance your workflow. Here are some advanced tips to maximize its utility.
If you frequently need specific options with git status, consider creating an alias in your Git configuration. For example, you can create an alias that includes detailed output:
Now, you can use git s, which provides a more concise summary of your status:
In this output:
M indicates modified files.D indicates deleted files.?? indicates untracked files.This compact view can be quicker to scan, especially when managing large projects.
If you’re only interested in the status of specific files or directories, you can follow up git status with their paths:
This will display the status specifically for file1.txt, helping you focus on relevant changes without sifting through other unrelated output.
Even experienced developers can make mistakes when using Git. Here are a few common pitfalls related to git status and how to recover.
It's easy to modify a file without staging it. Running git status before a commit will remind you of any changes that are not staged. If you forget to stage changes and commit, simply use:
Sometimes, you may see files listed as untracked when you expected them to be ignored. Reviewing your .gitignore file is essential. If a file is meant to be ignored but isn’t, adding the correct patterns to .gitignore will resolve this issue.
After updating .gitignore, run:
You should no longer see the previously untracked files if they match the ignore patterns.
If you see files listed as unmerged, it means a merge conflict occurred. git status will guide you through resolving these conflicts. After fixing conflicts in the files, use:
This will complete the merge process.
The git status command is a powerful tool that provides a clear view of your repository's current state. By regularly using it, you can manage your workflow more effectively, avoid common pitfalls, and navigate complex changes with confidence.
Now that you understand how to interpret and utilize git status, you are ready to explore git log.
In the next chapter, we will look at how to review your project's history and track changes over time, deepening your understanding of Git's capabilities.