Skip to content

Instantly share code, notes, and snippets.

@maheshgawali
Created July 6, 2018 07:53
Show Gist options
  • Save maheshgawali/325225af50f3ec13849724cdbf55ae92 to your computer and use it in GitHub Desktop.
Save maheshgawali/325225af50f3ec13849724cdbf55ae92 to your computer and use it in GitHub Desktop.
simple git merge script to merge current branch into a given branch
#!/bin/sh
# Usage: To merge current git branch into a branch called 'dev' and be back to the current branch
# ./git_merger.sh dev
target="$1"
current=`git branch | awk '/\*/{print $2}'`
git checkout ${target}
git pull origin ${target}
git pull origin ${current}
git push origin ${target}
git checkout ${current}
# This is extremely simple single purpose script, i normally use it in bashrc by putting this inside a function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment