Created
February 1, 2022 19:55
-
-
Save kingkool68/0a0a5f8832d3e0ebcab52c92be81d12a to your computer and use it in GitHub Desktop.
Quick little helper script to speed up your Git workflow if you ever need to merge a branch into another frequently (like your current feature branch into a `staging` branch). Useful as a custom command in the Git GUI Fork (https://fork.dev/)
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 | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
TARGET_BRANCH=staging | |
git fetch origin $TARGET_BRANCH | |
git checkout $TARGET_BRANCH | |
git merge "$CURRENT_BRANCH" -m "Merge branch '$CURRENT_BRANCH' into $TARGET_BRANCH" | |
git push origin $TARGET_BRANCH | |
git checkout "$CURRENT_BRANCH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment