Skip to main content

What is git status used for?

git status shows the current state of the working directory and the index (staging area): which files are modified, which are ready to commit, and which are not yet tracked by Git.

What exactly git status shows

1. Modified files

Files that:

  • are already tracked by Git
  • were modified after the last commit
  • have not yet been added to the staging area
text
modified: src/app.js

2. Staged files

Files that:

  • were added with git add
  • will be included in the next commit
text
new file: src/index.js

3. Untracked files

Files that:

  • exist in the project
  • are not under Git's control
text
Untracked files: config.env

4. Clean repository state

If there are no changes:

text
nothing to commit, working tree clean

Why git status is used in practice

  • To check exactly what will be committed
  • To avoid accidentally committing unwanted files
  • To see which files were forgotten (git add)
  • To check before git commit and git push
  • To quickly diagnose the state of the repository

Commonly used options

bash
git status # full information git status -s # short format

Example of short output:

text
M src/app.js ?? .env

Short answer for an interview

git status is used to view the current state of the repository: modified, staged, and untracked files.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.