首先,我们需要准备遥控器:
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
然后:您需要最新的远程分支:
git fetch production
然后:需要基于生产Heroku-branch创建新的分支:
git checkout -b hotfix/TICKET -t production/master
# where 'hotfix/TICKET' is your preferred branch name
然后您需要应用修补程序更改,例如:
1)手动:
# -> do something with codebase
git add .
git commit -m "hotfix: bla..."
2)通过cherry-pick特定提交:
git cherry-pick COMMIT_HASH
# or use this, if you need to cherry-pick the 'merge-commit':
git cherry-pick -m 1 MERGE_HASH
现在您需要推送更改:
git push production hotfix/TICKET:master
# where 'hotfix/TICKET' is your preferred branch name
而已。:tada: