Skip to content

Instantly share code, notes, and snippets.

@blendsdk
Created May 16, 2019 07:23
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 blendsdk/534ae1b8cbc0ef2fba85611c697dc8c1 to your computer and use it in GitHub Desktop.
Save blendsdk/534ae1b8cbc0ef2fba85611c697dc8c1 to your computer and use it in GitHub Desktop.
#!/bin/bash
curent_branch=$(git rev-parse --abbrev-ref HEAD)
exists=$(git show-ref refs/heads/$1)
back_branch=$1
if [ -z "${exists}" ]; then
echo -e "\033[91mERROR: \033[0mInvalid or missing back branch ${back_branch}"
exit 1;
fi
echo -e "\033[96mINFO: \033[0m Merging \033[93m${curent_branch} \033[0monto \033[93m${back_branch}\033[0m"
read -p "Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
git checkout ${back_branch}
git merge --no-ff ${curent_branch} -m"Mergin ${curent_branch}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment