user10794443
user10794443

Reputation:

Revert changes in git to particular time

I am in a git repo where I messed up a few things I want to revert it to same state as in the morning , I remember there is a command to do it but not able to find that, Can anyone please help? Thanks

Upvotes: 0

Views: 2400

Answers (2)

Kirill Khrapkov
Kirill Khrapkov

Reputation: 599

you can use command:

git reset --hard branch_name@{"15 minutes ago"}

Upvotes: 0

himayan
himayan

Reputation: 842

You can checkout to the commit id, after which you have messed things up. That will detach your HEAD. After that, you can create a new branch from there and proceed.

This answer might help you with more detailed explanation --> https://stackoverflow.com/a/4114122/13852431

Upvotes: 1

Related Questions