Skip to content

Instantly share code, notes, and snippets.

@sfletche
Last active May 5, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfletche/8304df107538620c977e2ca82abf3a37 to your computer and use it in GitHub Desktop.
Save sfletche/8304df107538620c977e2ca82abf3a37 to your computer and use it in GitHub Desktop.
Use the following to skip / remove a file from being updated by git
> git update-index --skip-worktree <filename>
Use the following to see which files are currently being skipped / ignored
> git ls-files -v . | grep ^S
Use the following to revert the skip
> git update-index --no-skip-worktrree <filename>
git will ignore any modifications or deletions to skipped files when staging commits or pulling changes
(essentially they are ignored by git)
Note: this only works for your copy of the repo (it's not possible for git to ignore changes to existing files for all users),
and so anyone who wants to differentiate their configuration will need to do this on their own machines.
Related SO -- https://stackoverflow.com/a/39776107/379512
Docs -- https://git-scm.com/docs/git-update-index#_skip_worktree_bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment