Skip to content

Instantly share code, notes, and snippets.

@danlherman
Last active December 9, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlherman/8a32fa05c2cf6018ed10 to your computer and use it in GitHub Desktop.
Save danlherman/8a32fa05c2cf6018ed10 to your computer and use it in GitHub Desktop.
script to create a url for showing the changes between the last two git tags for bitbucket
#!/bin/bash
#
# This utility creates a bitbucket URL for showing the changes between the last two tags for the
# git repo you are currently in.
#
# To install this place this file in your /usr/local/bin folder and
# chmod +x the file so it has execution rights. Then run 'bb-change-url' from any git repo.
#
# Dan Herman
#
#
repo_name=`git remote show origin | grep "Fetch URL:" | sed "s#^.*/\(.*\).git#\1#"`
current_tag=`git tag | tail -n1`
previous_tag=`git tag | tail -n2 | head -n1`
start_url="https://bitbucket.org/gdrepo/$repo_name/branches/compare/$current_tag..$previous_tag#diff"
echo $start_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment