Skip to content

Instantly share code, notes, and snippets.

@michalbe
Created June 2, 2014 09:16
Show Gist options
  • Save michalbe/6ee0014f4de9ab167b00 to your computer and use it in GitHub Desktop.
Save michalbe/6ee0014f4de9ab167b00 to your computer and use it in GitHub Desktop.
#!/bin/bash
mainBranch=$(git rev-parse --abbrev-ref HEAD);
repoName=$(basename $(git rev-parse --show-toplevel));
commitPrefix=$(echo '['$(echo $repoName | tr '[:lower:]' '[:upper:]')']');
#echo $mainBranch;
#echo $tempBranch;
if [[ $repoName == "tv" ]]; then
echo 'TV Series repo...';
git add .
git commit -m "$commitPrefix - $1";
git push origin master
open https://github.com/michalbe/tv-series/compare/gh-pages...master
else
echo 'Regular repo...';
tempBranch=$(echo $mainBranch'-temp');
if [[ $mainBranch == *Bug* ]]; then
commitPrefix=$(echo '['$(echo $repoName $mainBranch| tr '[:lower:]' '[:upper:]')']');
fi
git commit -m "$commitPrefix - $1";
git push origin $mainBranch:$tempBranch -f
open https://github.com/michalbe/$repoName/compare/$mainBranch...$tempBranch\?expand\=1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment