Information Technology Reference
In-Depth Information
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what
will be committed)
# (use "git checkout -- <file>..." to discard
changes in working directory)
#
#
deleted:
old-name.txt
#
# Untracked files:
# (use "git add <file>..." to include in what
will be committed)
#
# new-name.txt
no changes added to commit (use "git add" and/or
"git commit -a")
informs you about two changes. The first change concerns the file
old-
name.txt
. The file
old-name.txt
was deleted, but the operation
was not staged. In addition your repository now contains a new untracked
file named
new-name.txt
. Thus, when you rename a file, git con-
siders it as two separate operations: a deletion and a creation.
3. Check the simplified form of status. The output of
$ git status -s
will be:
_D old-name.txt
?? new-name.txt
The file
old-name.txt
was removed; this is denoted as
_D
. The file
new-name.txt
is treated by git as a new untracked file. Therefore, it is
denoted as
??
.
4. Stage a new file with the
$ git add new-name.txt
command. As
you remember from Recipe 4-1 there is no other way to stage a new un-
tracked file than to use
$ git add
command. Now the command
$
git status -s
prints: