[英]Git how to not include specific file(s) to commit
Im trying to not include some files to be commit. 我试图不包括一些要提交的文件。 For example, I don't want any change in the following files to be included in a commit:
例如,我不希望对提交中的以下文件进行任何更改:
bootstrap/start.php
So I include them in .gitignore like this: 因此,我将它们包括在.gitignore中,如下所示:
/bootstrap/compiled.php
/bootstrap/start.php
/vendor
composer.phar
composer.lock
.env.local.php
.env.php
.DS_Store
Thumbs.db.idea
.idea/
/public/dbase
/public/user_images
/app/config/lenovo
but when Im running git status
I still get this message: 但是当我运行
git status
我仍然收到此消息:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: bootstrap/start.php
no changes added to commit (use "git add" and/or "git commit -a")
How to do that? 怎么做? thank you
谢谢
bootstrap/start.php is already tracked by git. bootstrap / start.php已经被git跟踪了。
from the gitignore docs "A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below for details." 来自gitignore docs“ gitignore文件指定了Git应该忽略的故意未跟踪的文件。已经被Git跟踪的文件不受影响;有关详细信息,请参见下面的注释。”
尝试这个。
git update-index --assume-unchanged bootstrap/start.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.