20
submitted 3 days ago* (last edited 3 days ago) by Crumpled6273@lemmy.ca to c/programming@programming.dev

After I type 'git reverse ' in the terminal of vscodium, it always throws this message at me.

Auto-merging app/build/posts.html
CONFLICT (content): Merge conflict in app/build/posts.html
error: could not revert 0cc6763... new blog
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git revert --continue".
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
hint: Disable this message with "git config advice.mergeConflict false"

Then as the hints say, I type 'git status', fix the error, then commit and push again. But again the same message shows and I have no idea what to do. Getting mad as a beginner.

As i found no useful guides online, please help me to fix this issue without AI.

top 11 comments
sorted by: hot top new old
[-] hallettj@leminal.space 3 points 2 days ago

Not a direct answer, but I've really been liking jj. You can use it as a friendlier git frontend. It has fewer possible states (for example there are no revert-in-progress, rebase-in-progress, etc., or detached head states); and there is an undo command that really does undo any operation.

[-] Maestro@fedia.io 6 points 3 days ago

Happy for you that you fixed it. For future reference, keep this site handy to get help with most git issues:

https://ohshitgit.com/

[-] Crumpled6273@lemmy.ca 2 points 3 days ago

Thanks. Very interesting website.

Actually what is Dangit, Git ? Both looks identical.

[-] Solemarc@lemmy.world 9 points 3 days ago

I'm not sure what you're trying to do here. But you can probably get out of this state with

git revert --abort

Then your should pull from source again to make sure nothing weird is happening.

After that, if you're trying to rollback to a particular commit the command you probably want is

git reset --hard commit_hash

Which should drop all your local stuff and reset you straight to that commit.

[-] Crumpled6273@lemmy.ca 8 points 3 days ago

git reset --hard commit_hash This worked. Thanks.

[-] z3rOR0ne@lemmy.ml 3 points 3 days ago

As a jr programmer with constant fish bowl brain, thanks for reminding of this.

[-] Azzu@leminal.space 7 points 3 days ago* (last edited 3 days ago)

git revert does not go back to that commit, it takes the changes that are in that commit and tries to create a new set of changes that are the opposite, i.e. undo the changes of that specific commit.

You could have known that by reading the official documentation of that command, which says essentially the same thing: "Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them." https://git-scm.com/docs/git-revert

Now, if you look at the documentation of git reset, it says "changes which commit HEAD points to. This makes it possible to undo various Git operations, for example commit, merge, rebase, and pull." i.e. this does go back to that commit.

Since revert tries to create new changes, it's of course possible to get conflicts, since you probably changed a bunch since then. If you wanted git revert to work in this case, instead of reverting the commit "you want to go to", you could have reverted all commits since then instead.

So in English, what you did was "try to remove the specific changes within the commit I'm giving you"(git revert) instead of "go back to the commit I'm giving you" (git reset). Next time, try not to get mad and just do a web search, all of those results mention git reset or reverting all commits since then.

[-] Chewt@beehaw.org 1 points 3 days ago

It’s hard to say what the issue is since we are lacking some context. Have you made changes and commits after the commit you are trying to revert, or was that commit the most recent commit in the history?

Same with the fixes you mention, what exactly did you do to fix the merge conflict? Did you manually fix the files with the conflicts? Since you mention being a beginner with git, a common mistake would be not actually going into the files and resolving the conflicts, and just immediately doing git add/rm on the conflicting files.

I’m happy to walk you through the process if you could give a few more details, git can be complicated when you’re a beginner :)

[-] Crumpled6273@lemmy.ca 2 points 3 days ago

Yes, I needed to revert back to a commit that done around 2 weeks ago. Approximately 5-6 commits behind.

I fixed the merge conflict by going to the specific file it mentioned which is /app/build/posts.html. And on the code line vscodium suggested me to recover multiple lines of code i previously deleted from the html file. I recovered the deleted lines of code and performed a commit and push.

Now the issue is fixed by using git reset --hard commit_hash which is mentioned by another commenter.

Thank you for trying to help.

[-] tal@lemmy.today 1 points 3 days ago

I type ‘git status’, fix the error, then commit and push again.

Did you git add the modified file subsequent to changing it, as the git message says?

[-] Crumpled6273@lemmy.ca 1 points 3 days ago

Yes I did. But still the message displayed again and again.

But now the issue is fixed by using git reset --hard commit_hash which is mentioned by another commenter.

Thank you for your response.

this post was submitted on 09 Oct 2026
20 points (88.5% liked)

Programming

28795 readers
132 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS