Just a small update/fixup:
On 14/07/2017 00:39, Igor Djordjevic wrote:
> I guess it would be a kind of alias to doing:
>
> $ git checkout featureA
> $ git add ...
> $ git commit
> $ git checkout master
> $ git reset --hard HEAD^
> $ git merge featureA featureB
>
This should, in fact, be:
$ git checkout featureA
$ git commit
$ git checkout master
$ git reset --hard HEAD^
$ git merge <HEAD@{1} parents>
(removed "git add" step, as that is needed for proposed single step
solution as well, as a usual step preceding the commit; also replaced
concrete branch names in the last step with a more generic
description, better communicating real intent)
> In the same manner, it should be possible to drop a commit from the
> feature branch in a single step, for example returning to the state
> as shown in (1), or even "port" it from one branch to the other, like
> this (without a need for it to be the last commit, even):
>
> (3) o---o---o---\ (featureA)
> / \
> ---o---o---o-------M' (master, HEAD)
> \ /
> o---o---A'--o (featureB)
Here, the diagram should look like this:
(3) o---o---o---\ (featureA)
/ \
---o---o---o-------M'' (master, HEAD)
\ /
o---o---A''-o (featureB)
(replaced leftover M' from the previous diagram with M'' to show it`s
yet another (updated) merge commit, different from both M and M' in
terms of SHA1, yet the contents would probably, but not necessarily,
be the same for all three; same for leftover A', replaced with A'')
Regards,
Buga