First run this command to get all the merges in the main branch(the branch where the work was merged).
git log --merges
you will get something like this:
commit 125a57ec3bf3eeXXXXXXXXXXXXXXXXXXef347e30 (HEAD -> main, origin/main)Merge: b36d5ed7 3d431996Author: author_name <35093073+author_name@users.noreply.github.com>Date: Tue Jul 25 11:02:30 2023 +0500 Merge pull request #416 from organization_name/branch_that_was_merged commit_here
you will find the commit hash here "125a57ec3bf3eeXXXXXXXXXXXXXXXXXXef347e30"(which is 40 digit alphanumeric).Then run the following command.
git revert -m 1 125a57ec3bf3eeXXXXXXXXXXXXXXXXXXef347e30
Using that command your specific commit will be reverted.