You can specify multiple commits, commit intervals using git revert
. Here, you would need to find the first commit from branch 558 which diverged from master and the commit before the merge of the two branches.
Then, you can use:
git revert -n {first_commit}..{last_commit}
Here, the -n
option allows not to have a commit for each reverted commit, it only stages the changes which you can commit with an appropriate description afterwards.
It should work if your history is simple, like in your example.
Correction and clarification: git won't accept directly a merge commit or an interval containing a merge for a revert. It is however possible to revert an entire branch using only the merge commit and the option -m i
where i denotes which side of the merge to revert (starts from 1, so here it would be 2).
The whole issue is pretty delicate, and this document is an useful read about it.