[英]Git: Changes not staging when using git add * -A
Somehow, an .iml file has made its way into my git repo...不知何故,一个 .iml 文件进入了我的 git 仓库......
Here's how am I trying to get rid of it:这是我如何摆脱它:
*.iml
用额外的行编辑 .gitignore: *.iml
git add * -A
尝试git add * -A
更改: git add * -A
git commit -m"untrack .iml file and ignore for future commits"
尝试提交: git commit -m"untrack .iml file and ignore for future commits"
Problem:问题:
On branch mybranch
Changes not staged for commit:
modified: .gitignore
deleted: myproject.iml
no changes added to commit
Why are they not staged for commit?为什么他们不准备提交? I thought -A
would stage deletions too?我以为-A
也会删除? And also, in any way, I thought changes (like the one I made to .gitignore) are added to staging area without any special parameters?而且,无论如何,我认为更改(例如我对 .gitignore 所做的更改)会添加到暂存区而没有任何特殊参数?
It's weird because just before that, I committed a huge 20-file all-nighter, with changes, deletions, additions, branch within branch, all the goodies, with no problems - using the exact same procedure!这很奇怪,因为就在此之前,我通宵提交了一个巨大的 20 文件,包括更改、删除、添加、分支内分支、所有好东西,没有任何问题 - 使用完全相同的程序!
Never use ' *
' with the git add command: ' *
' means shell expansion, which, in your case, would not include any .xxx
file/folder.切勿在 git add 命令中使用 ' *
':' *
' 表示 shell 扩展,在您的情况下,它不包括任何.xxx
文件/文件夹。
Simply use:只需使用:
git add .
(Note the ' .
') (注意“ .
”)
No need for -A
, which is the default anyway, since Git 2.0 .不需要-A
,这是默认值,因为 Git 2.0 。
For more on this, see " Difference between .
(dot) and *
(asterisk) wildcards in Git ".有关更多信息,请参阅“ Git 中.
(点)和*
(星号)通配符之间的区别”。
命令是“git add .”('.'而不是'*')并且不需要-A
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.