Skip to content

Instantly share code, notes, and snippets.

@caifara
Created January 11, 2019 11:19
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 caifara/5ff741d019e28c90e62f7f8cd2765739 to your computer and use it in GitHub Desktop.
Save caifara/5ff741d019e28c90e62f7f8cd2765739 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# abort if git status is not clean
gs=$(git status)
clean_status="nothing to commit"
if test "${gs#*$clean_status}" != $gs;
then
echo "Git clean, continuing ..."
else
echo "Git status not clean! Cleanup first!"
exit 1
fi
branch=$( git rev-parse --abbrev-ref HEAD )
issue=$(echo $branch | sed 's/\(^[0-9]*\).*/\1/')
github_username=$(git config --get github.user)
echo
# indien eerste arg == merge bestaande pull request
if [ -n "$1" -a "$1" = "merge" ]; then
echo "switching to dev branch"
git checkout dev
# echo hub merge https://github.com/$github_username/
# hub merge $github_username/$branch --no-ff -m \"$message\"
# anders: pull request maken
else
# push branch to origin
echo git push origin $branch:$branch
git push origin $branch:$branch
# start pull request for issue number if given
echo
if [ ${#issue} -gt 0 ]
then
echo hub pull-request -i $issue -b by2-be:master
hub pull-request -i $issue -b by2-be:master
else
echo hub pull-request -b by2-be:master
hub pull-request -b by2-be:master
fi
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment