-1

I have created a new Angular project, then initialized a git local repository by git init then git commit -m "completed". But unfortunately I did a mistake by pressing ctrl+z in Windows and finally I lost all my files inside app folder of my project!

So is there a way to get them back using git commands?

EDIT: This is the result of git status command:

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")
Hasani
  • 3,543
  • 14
  • 65
  • 125

1 Answers1

0

With git reflog you will have the local changes. source.

And then checkout the hash that you wan to load.

Wandrille
  • 6,267
  • 3
  • 20
  • 43