我在一个分支上工作。我做了很多改变。完成工作后,我添加并投入工作。但是,当我尝试回到master分支时,我看到我的文件被删除了。这怎么可能?
这是我的提交历史记录。
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
为什么删除此文件?我不知道。我可以恢复吗?任何帮助表示赞赏。.我很害怕:(
答案 0 :(得分:1)
请尝试以下操作来还原您的分支机构:
git stash -u
(这将存储您的所有东西-因此,如果出现问题,您可以稍后将其还原)
然后:
git checkout refactor
(这将恢复您提交文件的分支)
此后,您可以通过运行以下命令来验证提交是否存在:
git log