Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git basics
  6. What is Git
  7. Three states of Git files
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Three states of Git files

As you can probably guess from the Git workflow in the previous section, files can be in one of three states:

  • Modified
  • Staged
  • Committed

Here’s what each state means:

  1. Modified: A file is considered "modified" when changes have been made to it in the working directory since the last commit. These changes have not yet been staged (indexed) for the next commit.
  2. Staged (i.e., Indexed): A file is "staged" or "indexed" when changes to it have been marked for inclusion in the next commit. These changes are ready to be committed to the Git repository.
  3. Committed: A file is "committed" when the changes that were staged have been permanently recorded in the Git repository. These changes are saved as part of a commit with a unique identifier (SHA-1 hash).

When you modify a file, you will only see those changes in the working tree. You must then stage the changes to include them in your next commit. Once you finish staging all files, you can commit them and add a message describing what you changed. Then your changes are safely recorded in a new snapshot in the repo.

Git components
The three file states for Git are modified, staged, and committed.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life