我创建了一个新的Angular项目,然后先按git init
,然后按git commit -m "completed"
初始化git本地存储库。但是不幸的是,我在Windows中按下ctrl+z
犯了一个错误,最后我丢失了项目app
文件夹中的所有文件!
那么有没有办法使用git
命令将它们取回?
编辑:这是git status
命令的结果:
On branch master
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: about/about.component.html
deleted: about/about.component.scss
deleted: about/about.component.spec.ts
deleted: about/about.component.ts
deleted: animations/app.animation.ts
deleted: app-routing/app-routing.module.spec.ts
deleted: app-routing/app-routing.module.ts
deleted: app-routing/routes.ts
deleted: app.component.html
deleted: app.component.scss
deleted: app.component.spec.ts
deleted: app.component.ts
deleted: app.module.ts
deleted: contact/contact.component.html
deleted: contact/contact.component.scss
deleted: contact/contact.component.spec.ts
deleted: contact/contact.component.ts
deleted: directives/highlight.directive.spec.ts
deleted: directives/highlight.directive.ts
deleted: dishdetail/dishdetail.component.html
deleted: dishdetail/dishdetail.component.scss
deleted: dishdetail/dishdetail.component.spec.ts
deleted: dishdetail/dishdetail.component.ts
deleted: favorites/favorites.component.html
deleted: favorites/favorites.component.scss
deleted: favorites/favorites.component.spec.ts
deleted: favorites/favorites.component.ts
deleted: flow/flow.component.html
deleted: flow/flow.component.scss
deleted: flow/flow.component.spec.ts
deleted: flow/flow.component.ts
deleted: footer/footer.component.html
deleted: footer/footer.component.scss
deleted: footer/footer.component.spec.ts
deleted: footer/footer.component.ts
deleted: header/header.component.html
deleted: header/header.component.scss
deleted: header/header.component.spec.ts
deleted: header/header.component.ts
deleted: home/home.component.html
deleted: home/home.component.scss
deleted: home/home.component.spec.ts
deleted: home/home.component.ts
deleted: login/login.component.html
deleted: login/login.component.scss
deleted: login/login.component.spec.ts
deleted: login/login.component.ts
deleted: menu/menu.component.html
deleted: menu/menu.component.scss
deleted: menu/menu.component.spec.ts
deleted: menu/menu.component.ts
deleted: services/auth-guard.service.spec.ts
deleted: services/auth-guard.service.ts
deleted: services/auth.interceptor.ts
deleted: services/auth.service.spec.ts
deleted: services/auth.service.ts
deleted: services/dish.service.spec.ts
deleted: services/dish.service.ts
deleted: services/favorite.service.spec.ts
deleted: services/favorite.service.ts
deleted: services/feedback.service.spec.ts
deleted: services/feedback.service.ts
deleted: services/leader.service.spec.ts
deleted: services/leader.service.ts
deleted: services/process-httpmsg.service.spec.ts
deleted: services/process-httpmsg.service.ts
deleted: services/promotion.service.spec.ts
deleted: services/promotion.service.ts
deleted: shared/baseurl.ts
deleted: shared/comment.ts
deleted: shared/dish.ts
deleted: shared/dishes.ts
deleted: shared/favorite.ts
deleted: shared/favoriteExists.ts
deleted: shared/feedback.ts
deleted: shared/leader.ts
deleted: shared/leaders.ts
deleted: shared/promotion.ts
deleted: shared/promotions.ts
deleted: shared/restConfig.ts
deleted: shared/user.ts
no changes added to commit (use "git add" and/or "git commit -a")
使用git reflog
,您将进行本地更改。 source。
然后检出您要加载的哈希。