Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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