joeyk16
joeyk16

Reputation: 1415

I reverted a commit. Now i want it all back

Hello i reverted a git commit called "Add user microposts".

I didn't mean to do it. I thought revert ment to go back to this version. But it actually means to get undo everything in that commit.

How do i get it back?

You can see what i did below.

enter image description here

Upvotes: 0

Views: 518

Answers (3)

MST
MST

Reputation: 689

Best way is git cherry-pick 4a593, assuming that's the hash that corresponds to your original commit. This will re-apply the commit on top of your codebase, undoing the revert.

Upvotes: 0

RAJ
RAJ

Reputation: 9747

Assuming the commit that you did as a revert is last commit that you have, you can remove that:

git reset --hard HEAD^

It will delete your last commit and will give the changes back.

Upvotes: 3

ilan berci
ilan berci

Reputation: 3881

if you want it back, you can revert the revert

git revert <commit>

Upvotes: -1

Related Questions