Skip to content

Instantly share code, notes, and snippets.

@grafikchaos
Created June 15, 2011 14:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save grafikchaos/1027225 to your computer and use it in GitHub Desktop.
Save grafikchaos/1027225 to your computer and use it in GitHub Desktop.
Ignore uncommitted changes in tracked files with Git
# == IGNORE LOCAL CHANGES
# ignore local changes to repository files or directories
git update-index --assume-unchanged path/to/file/or/directory
# -- ALIAS
# or you can alias it in your ~/.gitconfig
[alias]
au = update-index --assume-unchanged
# == UN-IGNORE LOCAL CHANGES
# update the index and removes the assume-unchanged flag so your changes
# can be committed
git update-index --no-assume-unchanged path/to/file/or/directory
# -- ALIAS
# or you can alias it in your ~/.gitconfig
[alias]
nau = update-index --no-assume-unchanged
# == LIST FILES/DIRS FLAGGED AS `assume-unchanged`
# list files/directories that have been marked as assume-unchanged
# lower-case `h` in first column tells us the file/directory has
# been marked as `assume-unchanged`
git ls-files -v [path/to/directory]
# -- ALIAS
# or alias it in your ~/.gitconfig
# this one passes the list to grep so we can filter on the lowercase letter
[alias]
ignored = !git ls-files -v | grep "^[[:lower:]]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment