Last active
September 11, 2015 12:44
-
-
Save chlab/9f95b2f4caa2492f8d7d to your computer and use it in GitHub Desktop.
Git: show all files you changed between two git commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# get git user from git config | |
gituser="$(git config user.email)" | |
# tell user how to set git user if we didn't get one | |
if [ -z "$gituser" ]; then | |
echo "Please configure your git user:" | |
echo "git config --global user.name \"your name\"" | |
echo "git config --global user.email \"your email\"" | |
exit 1 | |
fi | |
# we need at least two args | |
if [ $# -lt 2 ]; then | |
echo "Usage: $0 <commit-hash-from> <commit-hash-to>" | |
exit 1 | |
fi | |
git log --pretty="%H" --author="$gituser" $1..$2 | while read commit_hash; do git show --oneline --name-only $commit_hash | tail -n+2; done | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a little script I use to find all files I changed between two git commits.
Drop this script into your repo somewhere and use like:
Inspired by http://stackoverflow.com/a/6349405/682583