Skip to content

Instantly share code, notes, and snippets.

@xaptronic
Created November 10, 2011 14:52
Show Gist options
  • Save xaptronic/1355024 to your computer and use it in GitHub Desktop.
Save xaptronic/1355024 to your computer and use it in GitHub Desktop.
Get names of files changed in the latest commit
die () {
echo >&2 "$@"
exit 1
}
HOW_FAR=1
[ "$#" -eq 0 ] || HOW_FAR=$1
echo $HOW_FAR | grep -E -q '^[0-9]+$' || die "need to pass a number if you gonna pass"
git log -n$HOW_FAR --oneline | cut -f1 -d' ' | xargs -I% git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT % | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment