Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JeffCost/3844114 to your computer and use it in GitHub Desktop.
Save JeffCost/3844114 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