你Git忽略观察/跟踪特定目录/文件的方式.你刚刚运行这个:
git update-index --assume-unchanged <file>
现在你如何撤消它,以便再次观看它们?(我们称之为取消.)
有没有办法看到为什么一些文件被git忽略(即.gitignore文件中的哪个规则导致文件被忽略)?
想象一下,我有这个(或更复杂的场景,有数百个文件夹和数十个.gitignore文件:
/
-.gitignore
-folder/
-.gitignore
-subfolder/
-.gitignore
-file.txt
Run Code Online (Sandbox Code Playgroud)
如果我运行git add folder/subfolder/file.txtgit可能会抱怨它被忽略:
The following paths are ignored by one of your .gitignore files:
folder/subfolder/file.txt
Use -f if you really want to add them.
Run Code Online (Sandbox Code Playgroud)
有没有办法知道哪一个可能.gitignore有规则忽略这个文件,还显示规则?喜欢:
The following paths are ignored by your folder/.gitignore file (line 12: *.txt)
folder/subfolder/file.txt
Use -f if you really want to add them.
Run Code Online (Sandbox Code Playgroud)
要不就:
$ git why-is-ignored folder/subfolder/file.txt
folder/.gitignore:12:*.txt
Run Code Online (Sandbox Code Playgroud) 我有一个文件(config.php),已经提交给Git存储库,但我想在本地忽略,即我希望该文件保留在存储库中,但强制Git忽略对它的任何更改.
我将文件放入.gitignore,但它仍然标记为已更改,Git仍在尝试对其进行更改,每次我提交的内容.任何想法,我错过了什么或做错了什么?