Я не сделал, но почему Git удалил мои файлы?Как это исправить? - PullRequest
0 голосов
/ 24 сентября 2018

Я работал на ветке.Я сделал кучу изменений.Когда я закончил свою работу, я добавил и посвятил.Но когда я попытался вернуться в главную ветку, я увидел, что мои файлы были удалены.Как это возможно?

здесь моя история коммитов.

 Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ gs
On branch refactor
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)

        modified:   app/Http/Controllers/DownloadsController.php
        modified:   app/Http/Controllers/ProductsController.php
        modified:   app/Product.php
        deleted:    database/factories/UserFactory.php
        modified:   database/migrations/2018_09_01_105020_create_products_table.                                                                                                                php
        modified:   resources/views/auth/agreement.blade.php
        modified:   resources/views/layouts/admin_app.blade.php
        modified:   resources/views/layouts/app.blade.php
        modified:   resources/views/layouts/left_sidebar.blade.php
        modified:   resources/views/layouts/top_nav.blade.php
        modified:   resources/views/products/create.blade.php
        modified:   resources/views/products/edit.blade.php
        modified:   resources/views/products/index.blade.php
        modified:   routes/web.php

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        app/Http/Controllers/ImagesController.php
        app/Image.php
        database/factories/ModelFactory.php
        database/migrations/2018_09_16_172536_create_images_table.php
        resources/views/layouts/colors_top_nav.blade.php
        resources/views/layouts/content_footer.blade.php
        resources/views/layouts/mega_top_nav.blade.php
        resources/views/layouts/menu_top_nav.blade.php
        resources/views/layouts/navigation_left_sidebar.blade.php
        resources/views/layouts/notifications_top_nav.blade.php
        resources/views/layouts/profile_left_sidebar.blade.php
        resources/views/products/add_modal.blade.php
        resources/views/products/edit_modal.blade.php

no changes added to commit (use "git add" and/or "git commit -a")

Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ gaa
warning: LF will be replaced by CRLF in resources/views/layouts/app.blade.php.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/Http/Controllers/ImagesController.ph                                                                                                                p.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/Image.php.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in database/migrations/2018_09_16_172536_cr                                                                                                                eate_images_table.php.
The file will have its original line endings in your working directory.

Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ git commit -m "Refactor & Create Image database"
[refactor b7ee8d9] Refactor & Create Image database
 26 files changed, 1372 insertions(+), 2017 deletions(-)
 create mode 100644 app/Http/Controllers/ImagesController.php
 create mode 100644 app/Image.php
 rename database/factories/{UserFactory.php => ModelFactory.php} (86%)
 create mode 100644 database/migrations/2018_09_16_172536_create_images_table.ph                                                                                                                p
 create mode 100644 resources/views/layouts/colors_top_nav.blade.php
 create mode 100644 resources/views/layouts/content_footer.blade.php
 rewrite resources/views/layouts/left_sidebar.blade.php (95%)
 create mode 100644 resources/views/layouts/mega_top_nav.blade.php
 create mode 100644 resources/views/layouts/menu_top_nav.blade.php
 copy resources/views/layouts/{left_sidebar.blade.php => navigation_left_sidebar                                                                                                                .blade.php} (88%)
 create mode 100644 resources/views/layouts/notifications_top_nav.blade.php
 create mode 100644 resources/views/layouts/profile_left_sidebar.blade.php
 rewrite resources/views/layouts/top_nav.blade.php (89%)
 create mode 100644 resources/views/products/add_modal.blade.php
 create mode 100644 resources/views/products/edit_modal.blade.php
 rewrite resources/views/products/index.blade.php (87%)

Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ git log
commit b7ee8d9cc303345a9b0211f9ff0dd59 (HEAD -> refactor)
Author: Mehmet Dogan <mehmetd@gmail.com>
Date:   Mon Sep 24 08:43:10 2018 +0300

    Refactor & Create Image database

gaa означает git add.gs означает git status

    Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ git checkout master
fatal: cannot create directory at 'database/factories': Permission denied

Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ git status
On branch refactor
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)

        modified:   app/Http/Controllers/DownloadsController.php
        deleted:    app/Http/Controllers/ImagesController.php
        modified:   app/Http/Controllers/ProductsController.php
        deleted:    app/Image.php
        modified:   app/Product.php
        deleted:    database/factories/ModelFactory.php
        deleted:    database/migrations/2018_09_16_172536_create_images_table.php
        deleted:    resources/views/layouts/colors_top_nav.blade.php
        deleted:    resources/views/layouts/content_footer.blade.php
        deleted:    resources/views/layouts/mega_top_nav.blade.php
        deleted:    resources/views/layouts/menu_top_nav.blade.php
        deleted:    resources/views/layouts/navigation_left_sidebar.blade.php
        deleted:    resources/views/layouts/notifications_top_nav.blade.php
        deleted:    resources/views/layouts/profile_left_sidebar.blade.php
        deleted:    resources/views/products/add_modal.blade.php
        deleted:    resources/views/products/edit_modal.blade.php

no changes added to commit (use "git add" and/or "git commit -a")

Mehmet@DESKTOP-DP8IB MINGW64 /c/xampp/htdocs/comme (refactor)
$ git checkout
M       app/Http/Controllers/DownloadsController.php
D       app/Http/Controllers/ImagesController.php
M       app/Http/Controllers/ProductsController.php
D       app/Image.php
M       app/Product.php
D       database/factories/ModelFactory.php
D       database/migrations/2018_09_16_172536_create_images_table.php
D       resources/views/layouts/colors_top_nav.blade.php
D       resources/views/layouts/content_footer.blade.php
D       resources/views/layouts/mega_top_nav.blade.php
D       resources/views/layouts/menu_top_nav.blade.php
D       resources/views/layouts/navigation_left_sidebar.blade.php
D       resources/views/layouts/notifications_top_nav.blade.php
D       resources/views/layouts/profile_left_sidebar.blade.php
D       resources/views/products/add_modal.blade.php
D       resources/views/products/edit_modal.blade.php

Почему эти файлы удалены?Я не знаю.Могу ли я их восстановить?Любая помощь приветствуется .. Я так напуган: (

1 Ответ

0 голосов
/ 24 сентября 2018

Попробуйте следующее для восстановления вашей ветки:

git stash -u

(это сохранит все, что у вас есть - так что вы сможете восстановить его позже в случае проблем)

и затем:

git checkout refactor

(это восстановит вашу ветку, в которой вы зафиксировали свои файлы)

После этого вы можете проверить, что ваш коммит есть, выполнив:

git log

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...