Before all, we need preparate the remote:
git remote -v
# should contain the production remote with whatever name (better producation for sure), for example:
#
# production https://git.heroku.com/your-repo-prod.git (fetch)
# production https://git.heroku.com/your-repo-prod.git (push)
# staging https://git.heroku.com/your-repo-staging.git (fetch)
# staging https://git.heroku.com/your-repo-staging.git (push)
# if not, use this to add:
git remote add production https://git.heroku.com/your-repo.git
Then: you need up-to-date the remote branches:
git fetch production
Then: Need to create the new branch based on production Heroku-branch:
git checkout -b hotfix/TICKET -t production/master
# where 'hotfix/TICKET' is your preferred branch name
Then you need to apply the hotfix changes, for example:
1) manually:
# -> do something with codebase
git add .
git commit -m "hotfix: bla..."
2) by cherry-pick specific commit:
git cherry-pick COMMIT_HASH
# or use this, if you need to cherry-pick the 'merge-commit':
git cherry-pick -m 1 MERGE_HASH
now you need to push changes:
git push production hotfix/TICKET:master
# where 'hotfix/TICKET' is your preferred branch name
That's it. :tada: