Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo git mixed reset?

Tags:

git

I ran below command in my working directory.

git reset

It printed names of some files like

M /path/to/file

From What does 'git reset' command do without any option? I understand that git reset = git reset --mixed HEAD

How do I undo the above operation?

like image 386
user13107 Avatar asked Oct 15 '25 14:10

user13107


1 Answers

If you just did 'git reset' you have just unstaged your files, but you still have your modifications in your working directory. So you didn't lose anything, nor changed anything as you reset to HEAD.

Even if you had done a 'git reset HEAD~2' for example, which would have change your working directory, you could still use the reflog to recover, as explained in this question

like image 94
cexbrayat Avatar answered Oct 18 '25 08:10

cexbrayat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!