Git:文件“已更改但未更新”

什么是“已更改但未更新的含义”?这些文件是在git,他们已被修改,但当我运行“git状态”,这些更改显示在“已更改但未更新”,而不是“要提交的更改”。

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# modified:   breakouts/views.py
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified:   templates/registration/login.html
# modified:   templates/registration/registration.html

# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# context_processors.py
# static/#css.css#

因为他们已经被添加了,为什么不是他们“提交的更改”?

你必须使用git add每次或使用git commit -a或git commit –all而不是纯git commit。

Git docs

-a
--all
  Tell the command to automatically stage files that have been modified
  and deleted, but new files you have not told git about are not affected.

add基本上是“通知这个文件/目录”命令。不是CVS或subversion的跟踪更改此文件。

相关文章
相关标签/搜索