How to list files ignored with 'skip
I have used git update-index --skip-worktree <file>
as suggested here to make git ignore local changes to a tracked file. But now I have forgotten which files I have applied it to. How can I list all files that have skip-worktree flag applied to them?
Use the following command:
git ls-files -v . | grep ^S
Explanation: git ls-files .
lists all files in the repo (assuming you are in the root folder). -v
makes the output verbose, meaning that it will abbreviate the file status with a letter in front of the filename. The options are:
H cached
S skip-worktree
M unmerged
R removed/deleted
C modified/changed
K to be killed
? other
Source
So, to only list files with skip-worktree
flag, the output is piped to grep with ^S
as argument, meaning that only lines beginning with S are listed.
上一篇: 如何处理独立头脑中的犯下行为
下一篇: 如何列出使用'skip'忽略的文件