Skip to content

Instantly share code, notes, and snippets.

@lukemoderwell
Last active January 15, 2019 21:30
Show Gist options
  • Save lukemoderwell/3b75b0cd941a7a5ead0519ece33b1c42 to your computer and use it in GitHub Desktop.
Save lukemoderwell/3b75b0cd941a7a5ead0519ece33b1c42 to your computer and use it in GitHub Desktop.
A simple bash script that automates the process of "hotfixing" or cherry-picking commits through branches. It creates unique branches so that you can merge only what need.
#!/usr/bin/env bash
autopick() {
git fetch --all &&
git checkout release &&
git pull &&
git submodule update &&
git checkout -b hotfix/rel-$2 &&
git cherry-pick $1 &&
git push -u origin hotfix/rel-$2 &&
git checkout master &&
git pull &&
git submodule update &&
git checkout -b hotfix/mas-$2 &&
git cherry-pick $1 &&
git push -u origin hotfix/mas-$2
}
@lukemoderwell
Copy link
Author

lukemoderwell commented Dec 11, 2018

Instructions:

  1. Make sure you in the correct project directory (i.e. crds-net)
  2. Run autopick <YOUR_COMMIT_HASH_HERE> <YOUR_BRANCH_NAME_HERE>
  3. Two new branches will be created and pushed with cherry-picked commits
  4. Open two PRs and request the appropriate reviewers
  5. 💰 💵 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment