2013-10-18 236 views
0

意味着嗯,我是想git reset命令我伸手到下面的情況:這是什麼輸出GIT

  • 爲刪除
  • 我已經forthreset文件未跟蹤我已經在指數forthreset文件。

所以我添加使用git add . forthreset文件,然後當我做git status我沒有找到在指數

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 

什麼這是什麼意思?

回答

1

很有可能您已刪除並在索引中添加相同的文件(具有相同的內容)。 考慮:

> 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) 

但是,如果添加另一個內容(這裏:222),它會顯示爲已更改的文件:

> 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 
# 
+0

感謝@igr:是的含量是相同的.. – voila