Created
July 24, 2012 14:10
-
-
Save stefanpenner/3170094 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
function git-web-compare(){ | |
# Usage: | |
# cd <git_repo> | |
# git-web-compare <user/repo> | |
# -> copies url into clipboard | |
# -> opens browser window at url | |
# | |
# Example: | |
# cd rails | |
# git-web-compare rails/rails | |
# -> magick | |
local date=1.days | |
local last=$(git branch | grep '*' | cut -d ' ' -f 2-2) | |
local first=$(git log --pretty=oneline --since $date | cut -d ' ' -f 1-1 | tail -1) | |
local url="https://github.com/$1/compare/$first...$last" | |
echo $url | |
echo $url | pbcopy | |
open $url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment