voila
voila

Reputation: 1666

What does this output mean in GIT

Well I was trying git reset command and i reached to the situation below where:

So I added forthreset file using git add . then when I did git status I didn't find anything in index

C:\Users\xxx\Desktop\learn>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    forthreset
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       forthreset

C:\Users\xxx\Desktop\learn>git add forthreset

C:\Users\xxx\Desktop\learn>git status
# On branch master
nothing to commit, working directory clean

What does this mean ?

Upvotes: 0

Views: 114

Answers (1)

igr
igr

Reputation: 3499

Most likely you have removed and add same file in index (with same content). Consider:

> git init
Initialized empty Git repository in /tmp/t1/.git/
> echo 111 > a
> git add a
> git commit -m 1st
[master (root-commit) 89cc7c5] 1st
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
> git rm a
rm 'a'
> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    a
#
> echo 111 > a
> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    a
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       a
> git add a
> git status
# On branch master
nothing to commit (working directory clean)

But, if you add another content (here: 222), it will be shown as changed file:

> git rm a
rm 'a'
> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    a
#
> echo 222 > a
> git add a
> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   a
#

Upvotes: 1

Related Questions