Вот почему важно хорошо управлять своими ветками, в частности использовать ветки тем и сливаться вверх.
Это исправление должно быть сделано в ветке тем, разветвленной от общего предка всех веток, которыепотребуется исправление, а затем объединить его как с master, так и с paypal:
x - x - x - x ------------- X (master)
|\ |
| x - x - x ---- X (paypal) |
\ / /
x (bugfix) ---------------
Если вы уже сделали исправление и ошибочно сделали его на master вместо соответствующей базы слияния и историина master не было опубликовано, вам нужно выбрать или переместить его в нужное место:
# If the bugfix commit is not at the tip of master, you can rebase to get it there:
git rebase -i <commit before the bugfix> master
# rearrange the list of commits to put the bugfix at the tip, save and quit
# Now either cherry-pick or rebase the commit to the right place
# (rebase is easier if the bugfix is actually several commits)
# Cherry-pick
# make a branch and cherry-pick
git checkout -b bugfix <SHA1 of merge base>
git cherry-pick <SHA1 of bugfix>
# remove the commit from master, assuming it's still on the tip
git checkout master
git reset --hard master^
# or rebase
# make the bugfix branch (assuming it's still on the tip)
git branch bugfix master
# and remove the commit from master (assuming it's still on the tip)
git checkout master
git reset --hard master^ # or if the bugfix is composed of n commits, master~n
# rebase the bugfix branch to the right place
git rebase --onto <SHA1 of merge base> master bugfix
Если история имеет , все, что вы можете сделать, - это cherry-выберите исправление в ветке PayPal и не забудьте исправить это в следующий раз:
git checkout paypal
git cherry-pick <SHA1 of bugfix>