In my case, I currently maintain a front-end project and use Gitlab's Webhooks for continuous integration. The pushed code is automatically distributed to the CDN with a version number.
I need to fix two problems locally. I fixed them locally and submitted them to the same version twice (not pushed yet). However, these two problems need to be released twice (because the business parties are different), so I These two commits must be separated into two branches.
How to get a certain commit from branch B and put it into branch A?
git checkout branch-B
git reset --soft HEAD^
git checkout branch-A
git commit -m -a 'your comment'
However: It feels very uncomfortable to do this and does not have that smooth experience; and you cannot specify to get a certain submission at will.
I suggest you take a look
cherry-pick
这个命令,可以把任意commit
to merge, but be careful: use with caution, use with caution, use with caution!