There were two commits which should not go to main
, but we merged to main
from dev
and then we reverted those changes. Meanwhile we had some additional changes in dev
and then at later date we merged dev
to main
again. However, those two commits that we reverted are not in main
after merge has been completed from dev
to main
.
Need help to get the changes from the two commits to main
branch.
This happens because the commit IDs of those commits already exist in main
, so they can not be brought in again. You generally have 3 options:
git rebase --no-ff commit-X
where commit-X
is the parent of the first commit to rewrite. However, if their are other commits after those you wish to rewrite, you may not want to re-write the entire branch. In that case create a new branch off of the target branch (main
), cherry-pick the desired commits (which will change the IDs), and then merge them into the target (main
).main
. I only mention it in "general", but I highly doubt it is a viable option in your case.