Take the 2-minute tour ×

In the diagram shown on the git-scm page, Recording Changes to a Repository, it shows that when an untracked file is added, it moves to the unmodified state.

enter image description here

Is this correct? If I run $ git add myFile then $ git status, it shows that myFile is ready to be committed, which (from my beginner's perspective) looks unintuitive when looking at the diagram on that page.

Is the diagram incorrect, incomplete, or is my understanding of the diagram incorrect? If the latter, please could someone explain what is meant.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

When you git add a new previously untracked file, it is staged immediately (the blue stage in the image). The diagram is misleading in that regard, but the text on that page says as much under the paragraph Tracking New Files.

share|improve this answer
The diagram is arguably misleading; the 'add the file' arrow should go from 'untracked' to 'staged'. AFAIK, if you 'git rm file' then file is removed from the directory, and marked as deleted in the staging area; it doesn't simply become untracked. –  Jonathan Leffler Mar 5 '13 at 16:41
I think the arrow "add the file" doesn't mean directly git add. I think it is just trying to show how the file is moved from one state to another... Anyway it is not clear enough –  iberbeu Mar 5 '13 at 16:49
Thanks all, I am teaching an intro to git to the rest of my lab, but as a beginner, I'm trying to be careful not to teach anything I'm unsure about myself. –  ataulm Mar 5 '13 at 17:01
Given that "add the file" starts with "untracked", I assume the file already exists and can only interpret "add the file" as "add with git add". –  chepner Mar 5 '13 at 18:06
add comment

The graphic is misleading because it does not clearly call out the difference between a file and a version of the same file.

When you git add a file, you are adding the current version of it in your working directory to the Staging Area. The current version is now considered Staged and ready to commit. Because your working directory file contents are the same as those of the Staged version, the file is considered Unmodified. If you were to commit at this moment, the version that gets checked into the repo is the Staged version which also happens to match what the file looks like in your working directory.

But, suppose that instead of committing immediately after adding the file, you were to make some more changes to the file in your working directory. Now, you actually kind-of have two versions of the file: the Staged version from earlier, and, now the Modified version in your working directory. If you were to commit at this moment, the earlier Staged version gets checked in, which is different from what's in your working directory.

share|improve this answer
add comment

The answer to you question is yes. When you stage untracked file it becomes staged, not unmodified.

For me, the most difficult problem with this diagram, was the that it makes no sense to categorize files as:

  • untracked
  • unmodified
  • modified
  • staged

The correct categories, in my opinion, are:

  • untracked
  • unmodified
  • unstaged
  • staged

correct categories for state of the file

The important adjectives are marked with pink colour. The gray ones are redundant. You don't have to say: "the file is tracked, modified and staged". It is enough to say "the file is staged", as every staged file is modified and tracked.

Once you realize it, it is easy to understand, that untracked file can be only transferred into staged state. This is done by:

git add [filename]

There are no commands to make conversions:

  • untracked file => unmodified file
  • untracked file => unstaged file
share|improve this answer
add comment

Your Answer


