简体   繁体   English

提交所有文件都会忽略.gitignore中的文件?

[英]Commiting all files ignores the ones in .gitignore?

I'm new at Git, so my question is: 我是Git的新手,所以我的问题是:

Using 使用

git commit -a -m "Message"

Will respect the .gitignore file? 会尊重.gitignore文件吗? If I run 如果我跑步

git add *

It says cannot do it since there are files changed and marked as being ignore. 它说不能做,因为有文件被更改并标记为忽略。

The -a flag in git-commit does not commit all the files in the working directory, simply the ones that already exist in the repository that have changed. git-commit中的-a标志不会提交工作目录中的所有文件,只是提交在存储库中已更改的文件。 This is different from git add * which uses the shell expansion of * to add all of the files to staging, even the ones that git has not managed before. 这是从不同的git add *它使用的shell扩展*所有文件添加到分期,甚至git的以前没有管理的人。

(From git-commit man page) (来自git-commit手册页)

-a --all -a-全部

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. 告诉命令自动暂存已被修改和删除的文件,但是未告知git的新文件不受影响。

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

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