简体   繁体   English

SourceTree / git add-无法暂存修改的文件

[英]SourceTree / git add - Fail to stage modified files

I use SourceTree daily and never had such issue. 我每天都使用SourceTree,从来没有这样的问题。 But today I did some minor change and now I ended up having this issue: 但是今天我做了一些小的更改,现在我遇到了这个问题:

What I changed today? 我今天改变了什么?

I added p4Merge as merge tool and diff tool in my git config. 我在git config中添加了p4Merge作为合并工具和差异工具。 Then I changed my mind and deleted entries for p4Merge from my /.gitconfig file since I noticed I ended up having double entries for merge and diff tools there. 然后我改变了主意,并从/.gitconfig文件中删除了p4Merge的条目,因为我发现我在那里在那里出现了用于合并和差异工具的双重条目。

Here is how that looked 这是看起来

在此处输入图片说明

However, after removing all entries for p4Merge tool, I noticed that I am unable to stage files from SourceTree anymore. 但是,在删除了p4Merge工具的所有条目之后,我注意到我不再能够从SourceTree暂存文件。 Below screenshot shows that I have 4 upstaged files. 下面的屏幕截图显示了我有4个升级文件。 If I try to stage them by checking off the checkbox beside them, nothing will happen. 如果我通过选中它们旁边的复选框来上演它们,则什么也不会发生。 The wont be moved to Staged files section 不会移动到暂存文件部分

在此处输入图片说明

UPDATE UPDATE

Using git add . 使用git add . also does nothing and I notice that terminal shows files as modified but they are not red nor green but purple: 也不执行任何操作,我注意到终端显示文件已修改,但它们不是红色,绿色,而是紫色:

在此处输入图片说明

In order to fix this issue, I renamed one of the files above. 为了解决此问题,我重命名了上面的文件之一。

Next I issued git status and that saw the original file as deleted and new file with new name added 接下来,我发布了git status并看到原始文件已删除,并添加了新名称的新文件

git add . worked this time and I added file 这次工作了,我添加了文件

Then I issued git commit -m "message" to commit change 然后我发布了git commit -m "message"来提交更改

Then I changed name back and did git add . / git commit -m "message" 然后我改回了名字,并做了git add . / git commit -m "message" git add . / git commit -m "message" again and that fixed all files, not only the one I renamed. git add . / git commit -m "message"再次git add . / git commit -m "message" ,并修复了所有文件,不仅是我重命名的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM