Skip to content

Instantly share code, notes, and snippets.

@tommcdo
Created February 18, 2014 21:51
Show Gist options
  • Save tommcdo/9081027 to your computer and use it in GitHub Desktop.
Save tommcdo/9081027 to your computer and use it in GitHub Desktop.
#!/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