繁体   English   中英

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

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

所以我在一个单独的haml分支中重构我对haml的看法。 我不小心删除了我的新haml视图而不是旧的erb视图。

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

所以我做了一次重置

$ 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显示

$ 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
.
.
.

我从哪里开始才能保留haml文件并获得干净的工作目录?

我确定它很简单,但宁可要求而不是让它变得更糟。 谢谢

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

暂无
暂无

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

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