Git commit -a“未跟踪文件”? [英] Git commit -a "untracked files"?

查看:495
本文介绍了Git commit -a“未跟踪文件”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行 git commit -a 时,我看到以下内容:

 #请为您的更改输入提交消息。用'#'开始
#的行将被忽略,并且一个空的消息将中止提交。
#在分支上better_tag_show
#要提交的更改:
#(使用git reset HEAD< file> ...停用)

# modified:../assets/stylesheets/application.css
#modified:../views/pages/home.html.erb
#modified:../views/tags/show.html.erb
#modified:../../db/seeds.rb

#未记录文件:
#(使用git add< file> ...包括将承诺的内容)

#../assets/stylesheets/
#../views/pages/

那些未跟踪的文件是什么意思?所有的变化都被确认了。我不明白为什么git在这里警告我关于未跟踪的文件。

编辑

好的,我看到很多混淆的回复。这是我在 git commit -a 这个之后发生的事情。

 #在分支大师
没有提交(工作目录干净)

正如你所见,除了那些应用了更改的四个文件之外别无其他。



我的问题应该改写如下:为什么git会警告我关于未跟踪文件换句话说,是git commit消息中未跟踪的警告不必要的 >?

解决方案

对于有同样问题的其他人,请尝试运行

git add。
这将添加当前目录的所有文件以跟踪(包括未跟踪),然后使用

git commit -a 提交所有追踪文件。



Pacerier,做同样事情的一个班轮是

git add -A


When I do a git commit -a, I am seeing the following:

  # 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/

What does those untracked files mean? All the changes have been indeed tracked. I don't understand why git is warning me about untracked files here.

EDIT:

Ok I see a lot of confused replies. This is what happens after I git commit -a this.

# On branch master
nothing to commit (working directory clean)

As you can see, there is NOTHING other than those four files that had changes applied.

My question should be rephrased as follows: Why is git warning me about untracked files when all of the changes in this commit has been tracked?

In other words, is the untracked warning in the git commit message unnecessary?

解决方案

For others having the same problem, try running

git add . which will add all files of the current directory to track (including untracked) and then use

git commit -a to commit all tracked files.

As suggested by @Pacerier, one liner that does the same thing is

git add -A

这篇关于Git commit -a“未跟踪文件”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆