문제

I have two branches and want to cherry-pick a change from one and move it to the other. At a later date, when I merge the two repositories what effect will the cherry-pick have since the commit IDs will be different but the content will be the same.

도움이 되었습니까?

해결책

As long as the changed region is not affected in a later commit, the merge will ignore the regions changed in the cherry-pick, since they will be identical in each branch. If you later change one of the regions in one branch but not the other, you may have to resolve a conflict as usual.

다른 팁

This approach expect that the other branch (fix-branch) hasn't been pushed to origin (=> it can be rebased). To avoid that, we can rebase instead of merge:

git rebase master fix-branch

Now we are in fix-branch, master is bellow. Continue to switch back to master and merge:

git checkout master
git merge fix-branch

Source

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top