Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gschema/2c60b5166fa36df586dd to your computer and use it in GitHub Desktop.
Save gschema/2c60b5166fa36df586dd to your computer and use it in GitHub Desktop.
How to temporarily ignore and unignore file; check which files are ignored

How to temporarily ignore/unignore file changes in Git?

ignore:

git update-index --assume-unchanged <file>

unignore:

git update-index --no-assume-unchanged <file>

check ignored files

git ls-files -v | grep "^[[:lower:]]"

aliases

temp ignore file changes

git config --global alias.hide '!git update-index --assume-unchanged'
# use it:
git hide file/path.ext

unhide file(s)

git config --global alias.unhide '!git update-index --no-assume-unchanged'
# use it:
git unhide file/path.ext

unhide all

git config --global alias.unhideAll '!git update-index --really-refresh'
# use it:
git unhideAll

check ignored files

git config --global alias.hidden '!git ls-files -v | grep "^[[:lower:]]"'

# use it:
git hidden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment