How to skip some commits when doing merge? This situation is not a common one but an interesting one. Look at the picture above if you don’t understand the question.
[master]$ git cherry-pick 123474
[master]$ git cherry-pick 123475
And then the tree is like this:
474 475
---o---o---o---o---> dev
|
| 351 474 475
---o---o---o---o---o---o---o---> master
[dev]$ git checkout -b bug-to-merge-into-master
[bug-to-merge-into-master]$ git rebase -i 123471 123475
d 123471
d 123472
d 123473
p 123474
p 123475
[bug-to-merge-into-master]$ git checkout master
[master]$ git merge bug-to-merge-into-master
[master]$ git merge dev
[master]$ git revert -n 123471
[master]$ git revert -n 123472
[master]$ git revert -n 123473
[master]$ git commit -m "revert"
Now the tree is like this:
471 472 473 474 475
---o---o---o---o---o
| \
| \
---o---o---o---o---o---o---o--------o----->master
merge revert