问题
The GitHub documentation recommends against rebasing commits that have been pushed publicly.
We have two branches master
and dev
. I have made a change to master
for a hotfix that I would like to take across to dev
, dev
itself is fairly far ahead of master
.
In this case the hotfix is to 2 files and is only a 1 line change in each.
What is the easiest way to get this to the dev
branch without confusing things terribly?
回答1:
If the hotfix is the only thing in master
that isn't in dev
you could simply merge master
into your dev
branch.
Otherwise, you'd probably want to just cherry pick that hotfix commit into your dev
branch. Assuming that the hotfix is the latest commit in master
you could just do:
git checkout dev
git cherry-pick master
来源:https://stackoverflow.com/questions/13338089/alternative-to-rebasing-pushed-commits