什么是“更改未提交进行提交”意思 [英] What does "Changes not staged for commit" mean
问题描述
我想如果你想跟踪文件你应该 git add [要跟踪的文件]
我不知道为什么我收到了消息没有为commit提交更改
。
如果这些文件不是演出,不应该 git
显示那些文件是未跟踪
就像那样
我所做的只是从 develop
分支创建一个新功能,并在 feature / change_excel_format
分支中工作
我认为这些文件应该在 staged
状态下,
但是 git status
告诉我没有为commit提交的更改
简要说来,
我只知道git untracked
, staged
,有3个阶段,提交
任何人都可以告诉我,没有为commit提交的更改
所以如果我修改了文件<$ c
并输入 git st
(已在回购库中),$ c> a ,如果我 git a ,那么git会告诉我
没有为commit提交更改
code>那么文件 a
将在暂存状态中
如果我现在修改文件a
,在<$中将有两个文件a
的状态c $ c> git ,对吗?
所以我必须决定是否让上演一个
是提交或让不是阶段
被暂存,
然后是前一阶段文件a
将被丢弃?
<当你改变一个已经存在于版本库中的文件时,如果你希望它被暂存,你必须再次 git add
。
这允许您仅提交自上次提交以来所做更改的一部分。例如,假设您有文件 a
,文件 b
和文件 c
。您可以修改文件 a
和文件 b
,但是修改本质上是非常不同的,您不希望所有这些修改在一个单一的承诺。你发行
git add a
git commit a -mbugfix,in a
git add b
git commit b -mnew feature,in b
,如果你想提交所有你可以输入的内容
git commit -a
希望它有帮助。
I thought if you want to track the files you should git add [files you want to track]
I don't know why I got the messages Changes not staged for commit
.
If those files were not staged, shouldn't git
shows me those files were Untracked
like that
All I've done was create a new feature from develop
branch and worked in feature/change_excel_format
branch
I thought Those files should be in staged
status,
But git status
told me Changes not staged for commit
To brief,
I only know there are 3 stages in git untracked
, staged
, committed
Can any one tell me , what was the stage in for Changes not staged for commit
So if I modified the file a
(already in the repo)
and type git st
, the git will tell me Changes not staged for commit
if I git a
then the file a
will be in staged status
if I modified the file a
now, there will be two status of file a
in git
, right ?
So I have to decide if make the staged a
be commit or make the not stage a
to be staged,
and then the previous staged file a
will be discard ?
when you change a file which is already in the repository, you have to git add
it again if you want it to be staged.
This allows you to commit only a subset of the changes you made since the last commit. For example, let's say you have file a
, file b
and file c
. You modify file a
and file b
but the changes are very different in nature and you don't want all of them to be in one single commit. You issue
git add a
git commit a -m "bugfix, in a"
git add b
git commit b -m "new feature, in b"
As a side note, if you want to commit everything you can just type
git commit -a
Hope it helps.
这篇关于什么是“更改未提交进行提交”意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!