Git return all merges from a branch?

Suppose my story looks like this:

                     (2A)----(2B)------------ [dev-02]
                     /          \
(A)---(B)---(m1)---(C)---(m2)---(m3)---(D)--- [master]
  \         /            /
  (1A)---(1B)---------(1C)------------------- [dev-01]

Later, I understand that the branch dev-01is incorrect, so I want to return all merges from dev-01to master, but not from other branches.

I know this command will do the trick:

$ git revert -m1 <sha_m2> <sha_m1>

Or even best with one re-commit:

$ git revert -nm1 <sha_m2> <sha_m1>
$ git commit -m "Revert all from branch 'dev-01'"

The problem is that I do not know how to (programmatically) find merges from branch dev-01to master. Because this command:

$ git log --merges master

Show merging with a branch dev-02too. I know that if I leave Git to generate a merge message for me ( Merge branch 'd1'for example), then I can easily filter branches with some bash script, but what if I did not?

, master dev-01 fork, dev-01 master? ( ?)

+4

Source: https://habr.com/ru/post/1657886/


All Articles