简体   繁体   English

git恢复删除目录

[英]Git getting back deleted directory

I had a problem with Git, and wanted to recommit a certain commit. 我在Git上遇到问题,想重新提交某个提交。 But i didn't read the instructions well and lost my directory from my local environment. 但是我没有很好地阅读说明,并从本地环境中丢失了目录。 How can I get it back? 我如何找回它?

git log --oneline
592d36e Revert "Adding periodontogramma and job_management support"
dc477b8 Added django rest framework requirement
1f0f4ea Adding periodontogramma and job_management support this is the one I reverted and deleted my directory.

Can I do this? 我可以这样做吗?

git checkout 592d36e

Will it bring back my directories and files deleted? 它将带回我已删除的目录和文件吗?

EDIT: after getting my directories back now I get this 编辑:现在回到我的目录后我得到这个

 git log --graph --decorate --pretty=oneline --abbrev-commit --all
* 592d36e (origin/master, origin/HEAD, master) Revert "Adding periodontogramma a
* dc477b8 Added django rest framework requirement
* 1f0f4ea (HEAD) Adding periodontogramma and job_management support

How can I recommit changes in 1f0f4ea and get this HEAD detached message out of the way. 我如何重新提交1f0f4ea中的更改并获得此HEAD分离消息。 My remote repo is missing files that I allready have on my local 我的远程仓库中缺少我已经在本地存储的文件

Even easier, just revert your revert! 更简单,只需还原您的还原! If you've made no changes or commits since you ran the revert, just use git revert HEAD to undo the last commit (which, in this case, is the revert). 如果您自从运行还原以来未进行任何更改或提交,则只需使用git revert HEAD撤消上一次提交(在本例中为还原)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM