Created
May 23, 2021 11:26
-
-
Save DineshSolanki/b7af4e277e379ab1e67b9a6c6365f783 to your computer and use it in GitHub Desktop.
Backmerge current branch with master/developer or any branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
IFS='/' read -r id bname <<< "$branch" | |
IFS='_' read -r id bname <<< "$bname" | |
git update-index -q --refresh | |
if ! git diff-index --quiet HEAD --; then | |
echo "Working directory not clean, please commit your changes first" | |
exit | |
fi | |
echo "-------------------------------------------------------------------------" | |
echo "Switching to develop" | |
git checkout develop | |
echo "-------------------------------------------------------------------------" | |
echo "Pulling develop" | |
git pull | |
echo "-------------------------------------------------------------------------" | |
echo "switching to ${branch}" | |
git checkout ${branch} | |
echo "-------------------------------------------------------------------------" | |
echo "merging develop with ${branch}" | |
git merge develop | |
echo "-------------------------------------------------------------------------" | |
echo "Backmerge done..." | |
#change develop to whatever branch you want |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment