无法使用git add -u命令添加文件

时间:2015-04-02 14:02:25

标签: git

我正在尝试使用模式* .zip的文件,但无法使用模式* .zip添加。我无法这样做。 使用的步骤: 使用git add命令,将5.zip文件添加到索引中。 然后尝试使用git add -u * .zip使用* .zip添加其他zip文件。 但7.zip和8.zip没有得到更新。为什么呢?

C:\Users\myname\gitlearn\root>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   1.pub
#       new file:   2.pub
#       new file:   New Microsoft Publisher Document.pub 
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ../.gitconfig
#       5.zip
#       7.zip
#       8.zip
#       New Text Document - Copy.txt
#       New Text Document.txt
C:\Users\myname\gitlearn\root>git add 5.zip
C:\Users\myname\gitlearn\root>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   1.pub
#       new file:   2.pub
#       new file:   5.zip
#       new file:   New Microsoft Publisher Document.pub
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ../.gitconfig
#       7.zip
#       8.zip
#       New Text Document - Copy.txt
#       New Text Document.txt
C:\Users\myname\gitlearn\root>git add -u *.zip
C:\Users\myname\gitlearn\root>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   1.pub
#       new file:   2.pub
#       new file:   5.zip
#       new file:   New Microsoft Publisher Document.pub
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ../.gitconfig
#       7.zip
#       8.zip
#       New Text Document - Copy.txt
#       New Text Document.txt
C:\Users\myname\gitlearn\root>

1 个答案:

答案 0 :(得分:0)

我认为你不应该在命令中使用-u。此选项强制仅更新索引中已存在的文件(5.zip)并忽略非索引文件(7.zip和8.zip)。

尝试使用git add *.zip