Skip to content

Instantly share code, notes, and snippets.

@jonathands
Last active June 2, 2025 16:54
Show Gist options
  • Select an option

  • Save jonathands/fa9a80f0958c4bc46c10aa4b651273ca to your computer and use it in GitHub Desktop.

Select an option

Save jonathands/fa9a80f0958c4bc46c10aa4b651273ca to your computer and use it in GitHub Desktop.
merge a feature branch and get back
# On ~/.bashrc or equivalent
# usage
# gmergehml tries to merge current branch and gets back
# gmergehml name/ofbranch specify a branch
gmergehml() {
local feature_branch="${1:-$(git rev-parse --abbrev-ref HEAD)}"
read -p "Merge branch '$feature_branch' into 'homolog'? [y/N] " answer
case "$answer" in
[Yy]* )
git checkout homolog \
&& git merge "$feature_branch" \
&& git push \
&& git checkout "$feature_branch"
;;
* )
echo "Merge aborted."
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment