Skip to content

Instantly share code, notes, and snippets.

@shaunmolloy
Last active May 28, 2020 15:06
Show Gist options
  • Save shaunmolloy/e16a8f10b3f3212b09fd52de2a14204d to your computer and use it in GitHub Desktop.
Save shaunmolloy/e16a8f10b3f3212b09fd52de2a14204d to your computer and use it in GitHub Desktop.
git-changed - List changes from branch to master
#!/usr/bin/env bash
# git-changed
branch="master"
name_only=""
has_branch=0
args=""
if [ $# -gt 0 ]
then
for arg in "$@"
do
if [ "$arg" = "-N" ] || [ "$arg" = "--name" ]
then
name_only="--name-only"
shift
fi
if [ "$arg" = "-B" ] || [ "$arg" = "--branch" ]
then
has_branch=1
shift
continue
fi
if [ "$has_branch" -eq 1 ]
then
branch="$arg"
has_branch=0
shift
fi
done
fi
args="$@"
git diff $branch... $name_only $args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment