How to list files ignored with 'skip-worktree'

Git

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

Use the following command if on *nix (Linux, Mac):

git ls-files -v . | grep ^S

or, if on Windows, you can use:

git ls-files -v . | findstr "^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

Documentation

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.

Solution 2 - Git

For those using Tortoise Git, right click on the folder and choose TortoiseGit > Check for modifications, then only check Show ignore local changes flagged files.

If you want to stop ignoring a file, right click on it and choose Unflag as skip-worktree and assume-unchanged.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Question1615903View Question on Stackoverflow
Solution 1 - Git1615903View Answer on Stackoverflow
Solution 2 - Gituser276648View Answer on Stackoverflow