Git Status Command |Video upload date:  · Duration: PT1M0S  · Language: EN

Quick guide to git status showing tracked untracked staged and modified files and how to use the command effectively

If your repository had a daily check in meeting git status is the blunt instrument that tells the truth. It inspects the working tree and the staging area and then politely ruins your plans by showing untracked files and modified files you forgot about. This short git tutorial will help you read the output and act before you make an oops commit.

Run git status in the repo root

Open a terminal in your project root and run

git status

The command prints branch information and file states. The output separates untracked files modified files and staged files so the current state of the repo is obvious even when your brain is not cooperating.

Read the sections the right way

Look for headings like Changes to be committed and Changes not staged for commit. Files under the first heading are staged and ready for commit. Files under the second heading have edits in the working tree that have not been added to the staging area.

Staged versus modified files

Staged files are what will be recorded in the next commit. Modified files are changes you still have a chance to fix or hide. If you want to build a clean history use git add wisely and review the staged area before committing.

Handle untracked files and ignore noise

Untracked files show up when a file exists in the working tree but has not been added to the index. Add them with

git add path/to/file

Or keep clutter out of the way with a .gitignore file. Ignored files do not appear in the normal status output which keeps your focus on files that matter for the next commit.

Stage specific hunks when you care about quality

If you want surgical commits use

git add -p

This walks you through hunks and lets you stage only the parts you intend. After staging run git status again to confirm the staged section matches the changes you wanted to capture.

Use short and machine friendly formats for speed and scripting

When speed matters try the concise two column output

git status -s

To see branch and upstream info in one shot use

git status --branch

When writing scripts choose

git status --porcelain=v2

The porcelain v2 format is stable for machine parsing and will save you from brittle shell hacks later.

Quick checklist before committing

  • Run git status to see branch and file states
  • Confirm staged files are exactly what you intend
  • Use .gitignore to hide editor and build artifacts
  • Use git add -p for focused commits
  • Use git status -s or --porcelain=v2 when speed or scripts matter

A quick status check prevents accidental commits and keeps history readable which future developers will thank you for and which present you will appreciate when you are debugging less. If you want to feel like a responsible version control citizen run git status often and pretend you always planned it that way.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.