The things you see in the first image are merge conflict markers. They’re git’s way of showing you that the changes you’re trying to merge both changed the same locations and it’s asking you to tell it how to proceed. Git typically prevents you from committing files with merge conflicts like this.
It sounds like what you’re saying is that you made the commit that introduced these merge conflict markers “a while ago”? And now you want to delete the change that one commit introduced? If that’s correct, you can try using the git revert command. It sounds like you’re already familiar with this command, so I’m not sure what the question is?
For more wholesale rewriting of git history, you can use the git rebase command, specifically with the interactive option. You would have to give a range of commits that included the commit that you want to remove from the history. Then when given the list of commits, use the
drop instruction to delete the one commit you want removed. The documentation gives more information.
Let me know if I misunderstood though.