GitHub undo a discard

前提是你 提交于 2019-12-18 13:27:12

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/22330909/github-undo-a-discard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!