I was working on some files and accidentally discarded all the files from github. I know that as soon as you discard there is an undo button at the bottom. But I restarted my gitub and now I do not have the undo button anymore. Is there any way I can undo my discard and get back my files? I hope there is, pls let me know if you have any ideas.
Thanks!
The "restore" command helps to unstage or even discard uncommitted local changes. On the one hand, the command can be used to undo the effects of git add and unstage changes you have previously added to the Staging Area.
Press Ctrl+z for Undo & CTRL+S for saving the changes.
Ctrl + Z or restore from trash. I have lost work to this multiple times, and to remedy this, I commit all the changes, then reset the branch to the previous commit. Then you can run git discard to discard the changes, but keep a reference in the reflog.
If you know where the last changes were made and you didn't close the IDE, just go to that particular file and try undo (ctrl+z).
The discard (that you can see in "Undo Button in GitHub for Windows") is available to reset files added to the index.
That means you added files, and reset them before any commit.
The GitHub for Windows/Mac won't help you there.
You need to recover those files from the git repo (git fsck --unreachable --no-reflogs --no-cache HEAD
).
See "Recovering added file after doing git reset --hard HEAD^
" for more.
The OP Benz_java mentions "restoring lost commits", for looking in the reflog for lost commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With