What is the difference between a tracked, untracked, and ignored file in Git?

Last updated 6 July 2026

The distinction is about whether Git knows and watches a file: tracked files are already in Git's index/history, untracked files exist in the working directory but Git isn't watching them yet, and ignored files are untracked files Git is explicitly told to skip.

  • Tracked: Files Git already knows about (previously committed or staged); Git reports them as modified, staged, or unchanged.

  • Untracked:

    • New files present on disk that have never been added; git status lists them under "Untracked files."

    • Becomes tracked once you run git add.

  • Ignored:

    • Untracked files matching a pattern in .gitignore; Git hides them from status and won't auto-stage them.

    • Caveat: ignoring does not affect files already tracked; you must git rm --cached them first.

  • https://git-scm.com/book/ms/v2/Git-Basics-Recording-Changes-to-the-Repository
  • https://www.atlassian.com/git/tutorials/saving-changes/gitignore
  • https://dev.to/nsilva1/gitignore-does-not-ignore-folder-1n4o
  • https://git-scm.com/docs/gitignore
  • https://www.developersdigest.tech/blog/git-ignore-methods-beyond-gitignore
  • https://www.freecodecamp.org/news/learn-git-basics/
  • https://flaviocopes.com/courses/git/ignore-files/
  • https://www.geeksforgeeks.org/git/how-to-stop-tracking-and-ignore-changes-to-a-file-in-git/
All Git interview questions