Guillherme06
Guillherme06

Reputation: 11

Git revert not working?

I messed up when publishing a project in React and now my master branch's other projects are gone. I can't seem to figure out how to?

My Github page: https://github.com/guillherme6/guillherme6.github.io

I'm using:

git revert 19512552f7d7829c241e82a6b8b730624f956996

and

git revert 1951255

What am I doing wrong?

Upvotes: 1

Views: 2264

Answers (2)

Kenry Sanchez
Kenry Sanchez

Reputation: 1743

if you want to revert a commit from your git stack, you can do those following.

  1. if you want to revert the commit but, not lose the changes you can type

git reset --soft HEAD@{index of the commit}

  1. if you want to delete the commit from your git stack

git reset --hard HEAD~index of the commit

Just one thing. if you want to use those commands, you should know that it removes from the first commit until the commit you'll assign. that means if you want to remove git reset --hard HEAD~2 it will remove from commit index 1 until commit index 2.

Of course, also you can use git revert but is the same pattern. you'd type the index commit from your head stack

example to revert to two commits prior

git revert HEAD~2

Upvotes: 1

Sergio Rivas
Sergio Rivas

Reputation: 563

If you want to an specific commit do git checkout 19512552f7d7829c241e82a6b8b730624f956996

Upvotes: 0

Related Questions