Last active
May 28, 2020 15:06
-
-
Save shaunmolloy/e16a8f10b3f3212b09fd52de2a14204d to your computer and use it in GitHub Desktop.
git-changed - List changes from branch to master
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
#!/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