Use this:
git update-index --skip-worktree path/file.cfg
And to restore:
git update-index --no-skip-worktree path/file.cfg
Lastly, if you want to list files that are marked with skip-worktree
:
git ls-files -v | grep ^S | awk '{print $2}'
To simplify, you can make an alias for that in your $HOME/.gitconfig
:
[alias]
ls-ignored-changes = !git ls-files -v | grep ^S | awk '{print $2}'
Then you can type just git ls-ignored-changes
. It even works with auto-completion if you have the git-completion
in place (for bash, tcsh, zsh).