Help undoing a commit made a while ago for my code

My issue is that i get everything done, Revert the commit, push a new commit reverting the changes, pushed it to the origin but not really. now my issue is that in the code after all of this i get this.

Note the second image is actually from before i pushed to have the commit made. the first image is the changes GIT desktop is making. IDK what happeneing and peole who use Git hub a lot arnt helping amongst my friends.

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.

1 Like