Git:文件“已更改但未更新” [英] Git: file "changed but not updated"

查看:339
本文介绍了Git:文件“已更改但未更新”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更改但未更新的意思是什么?这些文件在git中,它们已被修改,但是当我运行git status时,这些更改显示在已更改但未更新下,而不是要更改的提交。

 #在分支主机上
#要提交的更改:
#(使用git reset HEAD< file> ... b $ b#
#modified:breakouts / views.py

#已更改但未更新:
#(使用git add< file> ...更新将提交的内容)
#(使用git checkout - < file> ...放弃工作目录中的更改)

#modified:templates / registration / login .html
#modified:templates / registration / registration.html

#未记录文件:
#(使用git add< file> ...将被提交)

#context_processors.py
#static /#css.css#

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

解决方案

您必须每次使用 git add 使用 git commit -a git commit --all 而不是普通 git commit



<来自 Git文档

 
-a
--all
告诉命令自动对已被修改
并被删除的文件进行分段处理,但没有告知git的新文件不受影响。

add 基本上是注意此文件/目录命令。不是CVS或Subversion的曲目变成这个文件。


What does "Changed but not updated mean"? These files are in git, they've been modified but when I run "git status," these changes appear under "Changed but not updated" instead of "Changes to be commited."

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

Since they've already been added why aren't they "Changes to committed"?

解决方案

You have to use git add every time OR use git commit -a or git commit --all instead of plain git commit.

from 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 is basically the "take notice of this file/directory" command. Not CVS's or subversion's track changes to this file.

这篇关于Git:文件“已更改但未更新”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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