Skip to content

Instantly share code, notes, and snippets.

@umamiMike
Created October 24, 2017 20:42
Show Gist options
  • Save umamiMike/152c1f7a5f6ecc3f3568b7e235413b38 to your computer and use it in GitHub Desktop.
Save umamiMike/152c1f7a5f6ecc3f3568b7e235413b38 to your computer and use it in GitHub Desktop.
gitdiff filelist
#!/bin/bash
# usage: gitdiff {another branch}
# will show the files which are different between the branch you are currently on
# and the other branch
# I use it to remind myself which files I have been editing
# TODO: pump it into quickfix in vim
while getopts ":h:" opt; do
case ${opt} in
h)
echo "this command lists all files in the current branch which are DIFFERENT from the branch you supply as an argument"
esac
done
if [ -z $1 ]; then
echo "you must supply a branch name or commit sha as an argument"
else
thisbranch=$(git branch |grep '\*' | cut -d ' ' -f2)
echo $thisbranch
git diff origin/$1...$thisbranch --name-only
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment