Checking Repository Status
You'll learn how to inspect which files are modified, staged, or untracked in your Git working directory using git status.
Understanding Repository State
When you're working with Git, your repository can have files in various states at any given moment. Some files might be modified but not yet staged, others are staged and ready to commit, and some might be completely new (untracked). How do you know what's where? That's exactly what git status tells you.
Think of git status as your repository's dashboard—it gives you a snapshot of what's happening right now. It's like checking your to-do list to see which tasks are pending, which are in progress, and which are ready to be marked complete.
What git status Shows You
When you run git status, Git reports:
- Modified files: Files you've changed since your last commit but haven't staged yet
- Staged files: Files you've added to the staging area with
git add, ready for the next commit - Untracked files: New files Git doesn't know about yet (you haven't used
git addon them) - Clean working directory: When nothing needs attention
This command also tells you which branch you're on and whether your local repository is ahead or behind remote versions (once you start working with remote repositories).
Running the Command
Simply type:
git status
You can also use the shorthand version for a more compact output:
git status -s
Key Takeaway: git status is your go-to command for understanding the current state of your repository—run it frequently to stay oriented before staging, committing, or making decisions about your next Git action.