当我做了git commit -a
,我看到以下内容:Git commit -a“未跟踪文件”?
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch better_tag_show
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: ../assets/stylesheets/application.css
# modified: ../views/pages/home.html.erb
# modified: ../views/tags/show.html.erb
# modified: ../../db/seeds.rb
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ../assets/stylesheets/
# ../views/pages/
什么是那些未跟踪的文件是什么意思?所有的变化都被确认了。我不明白为什么git在这里警告我关于未跟踪的文件。
编辑:
好,我看到了很多困惑的答复。这是我在git commit -a
之后发生的事情。
# On branch master
nothing to commit (working directory clean)
正如您所看到的,除了那些应用了更改的这四个文件以外没有其他任何东西。
我的问题应该改写如下:为什么git会在跟踪此提交中的所有更改时警告我关于未跟踪的文件?
换句话说,是在GIT中的未跟踪警告提交消息不必要?
'(使用 “混帐添加 ...” 中包括哪些将被提交)' –
zengr
zengr不需要,因为git commit -a会将所有更改提交到已跟踪的文件。 – disappearedng
直到现在,文件从来没有被“添加”过,它是必需的。从'-a'的文档:*告诉命令自动对已被修改和删除的文件进行分段处理,但是**没有告诉git的新文件不受影响**。 –