git cherry-pick 很香

如何把一个已经提交到master分支的commit撤回并合并到dev?

背景:master分支和dev分支,把本改提交dev的代码push到了master。

然后我就先把master git revert掉,然后切到dev分支通过git cherry-pick commit_id来把那个提交合到dev,最后直接git push就可以了。

 

> git checkout dev

> git log master

commit a0f24e34cf50e0acbd5c3d1f217e295662c68512 (origin/hotfix-bug-not-exists-goods, master, hotfix-bug-not-exists-goods)
Author: xxx
Date:   Tue Apr 21 16:26:25 2020 +0800

    商铺不存在错误码过滤

commit a7a4b404c15042d3e8140404afb494ecae2b9249
Author: xxx
Date:   Mon Apr 20 20:50:02 2020 +0800

    add app_name=eos

commit 5cb94ac7caf2ed4d7dea4cef6357ac5f0b61039a
Merge: 30940ad 77d9c03
Author: xxx
Date:   Mon Apr 20 16:06:13 2020 +0800

    Merge branch 'dev'

> git cherry-pick a7a4b404c15042d3e8140404afb494ecae2b9249

> git push

你可能感兴趣的:(一句话)