简体   繁体   English

Git删除了文件。 我如何获得干净的工作目录?

[英]Git deleted files sticking around. How do i get a clean working directory?

So I'm refactoring my views in haml in a separate haml branch. 所以我在一个单独的haml分支中重构我对haml的看法。 I accidentally removed my new haml views instead of old erb views. 我不小心删除了我的新haml视图而不是旧的erb视图。

$ git rm app/views/projects/edit.html.haml app/views/projects/new.html.haml .....

So I did a reset 所以我做了一次重置

$ git reset HEAD app/views/projects/edit.html.haml app/views/projects/new.html.haml .....
Unstaged changes after reset:
D   app/views/projects/_form.html.erb
D   app/views/projects/edit.html.erb
D   app/views/projects/edit.html.haml
.
.
.  

git status shows git status显示

$ git status
# On branch haml
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   deleted:    app/views/projects/_form.html.erb
#   deleted:    app/views/projects/edit.html.erb
#   deleted:    app/views/projects/edit.html.haml
.
.
.

Where do I go from here in order to keep the haml files only and get a clean working directory? 我从哪里开始才能保留haml文件并获得干净的工作目录?

Im sure its simple but would rather ask than make it worse. 我确定它很简单,但宁可要求而不是让它变得更糟。 Thanks 谢谢

你需要reset --hard ,这将更新工作目录。

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

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