Skip to content

Instantly share code, notes, and snippets.

@jspiro
Created May 18, 2017 04:02
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 jspiro/62f9c4f93a3ccf6c5f751e23de75a012 to your computer and use it in GitHub Desktop.
Save jspiro/62f9c4f93a3ccf6c5f751e23de75a012 to your computer and use it in GitHub Desktop.
git aliases for managing autogenerated code
# autogen files are files with diff unset in .gitattribute
ls-check-attr-diff = "!git ls-files --exclude-standard --modified | git check-attr --stdin diff"
ls-autogen = "!git ls-check-attr-diff | grep 'diff: unset' | sed 's/: diff:.*//'"
ls-no-autogen = "!git ls-check-attr-diff | grep -v 'diff: unset' | sed 's/: diff:.*//'"
discard-autogen = "!git ls-autogen | xargs git checkout --"
add-autogen = "!git ls-autogen | xargs git add"
add-no-autogen = "!git ls-no-autogen | xargs git add"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment