Git gets a certain commit of a certain branch?
PHP中文网
PHP中文网 2017-05-02 09:30:28
0
1
618

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.

The situation is as follows:

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.

So my question is:

How to get a certain commit from branch B and put it into branch A?

My own approach is like this:

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.

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
世界只因有你

I suggest you take a look cherry-pick 这个命令,可以把任意 commit to merge, but be careful: use with caution, use with caution, use with caution!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template