Created
February 18, 2014 21:51
-
-
Save tommcdo/9081027 to your computer and use it in GitHub Desktop.
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/bash | |
# Show changes that are only on the current branch. | |
# Useful when working on a feature branch | |
# | |
# USAGE: | |
# git since [COMMAND] [PARENT-BRANCH] | |
# | |
# COMMAND defaults to log | |
# | |
# EXAMPLE: | |
# git since | |
# git since diff | |
# git since log master | |
command=${1:-log} | |
me=$(git rev-parse --abbrev-ref HEAD) | |
parent=$2 | |
if [[ -z "$parent" ]]; then | |
base=$(git rev-parse $(git rev-list --topo-order --all --not $(git rev-list --all ^$me) | tail -n1)^) | |
else | |
base=$(git merge-base $me $parent) | |
fi | |
shift | |
git $command $@ $base..HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment