Django 如何恢复合并期间删除的已删除文件

Django 如何恢复合并期间删除的已删除文件,django,git,merge,merge-conflict-resolution,Django,Git,Merge,Merge Conflict Resolution,我试图删除主分支上的所有迁移文件。Git提示: error: Merging is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an

我试图删除主分支上的所有迁移文件。Git提示:

error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
Git提示:

error: the following files have changes staged in the index:
/middleware.py
project_management/models.py
sales/migrations/0001_initial.py
(使用--cached保存文件,或使用-f强制删除)

考虑到冲突只是由于这些迁移文件造成的,我键入:

git rm . -r
git rm . -r -f
现在,git已经删除了我的所有文件,包括模型、模板、视图、静态文件等

rm '.gitignore'
rm 'accounts/__init__.py'
rm 'accounts/__pycache__/__init__.cpython-36.pyc'
rm 'accounts/__pycache__/backends.cpython-36.pyc'
rm 'accounts/admin.py'
rm 'accounts/apps.py'
rm 'accounts/backends.py'
rm 'accounts/forms/__init__.py'
rm 'accounts/forms/authenticate.py'
rm 'accounts/forms/register.py'
rm 'accounts/migrations/0001_initial.py'
rm 'accounts/migrations/__init__.py'
rm 'accounts/models.py'
rm 'accounts/templates/login.html'
rm 'accounts/templates/signup.html'
rm 'accounts/tests.py'
rm 'accounts/urls.py'
rm 'accounts/views.py'
现在,当我

git status
它告诉我: 论分行行长 所有冲突已修复,但您仍在合并。 (使用“git提交”结束合并)

要提交的更改:

    deleted:    .gitignore
    deleted:    accounts/__init__.py
    deleted:    accounts/__pycache__/__init__.cpython-36.pyc
    deleted:    accounts/__pycache__/backends.cpython-36.pyc
    deleted:    accounts/admin.py
    deleted:    accounts/apps.py
    deleted:    accounts/backends.py
    deleted:    accounts/forms/__init__.py
    deleted:    accounts/forms/authenticate.py
    deleted:    accounts/forms/register.py
    deleted:    accounts/migrations/0001_initial.py
    deleted:    accounts/migrations/0002_auto_20170212_1028.py
    deleted:    accounts/migrations/__init__.py
    deleted:    accounts/models.py
    deleted:    accounts/templates/login.html
    deleted:    accounts/templates/signup.html
    deleted:    accounts/tests.py
    deleted:    accounts/urls.py
    deleted:    accounts/views.py
    ...
    Untracked files:
    (use "git add <file>..." to include in what will be committed)

    accounts/
    commonapp/
已删除:.gitignore
已删除:accounts/\uuu init\uuuu.py
已删除:accounts/\uuuupycache\uuuuuu/\uuuuuu init\uuuuuuuuu.cpython-36.pyc
已删除:accounts/\uuuu pycache\uuuu/backends.cpython-36.pyc
已删除:accounts/admin.py
已删除:accounts/apps.py
已删除:accounts/backends.py
已删除:accounts/forms/\uuuuu init\uuuuuuuu.py
已删除:accounts/forms/authenticate.py
已删除:accounts/forms/register.py
已删除:帐户/迁移/0001_initial.py
删除:账户/迁移/0002_自动_20170212_1028.py
已删除:accounts/migrations/__init__u;.py
已删除:accounts/models.py
已删除:accounts/templates/login.html
已删除:accounts/templates/signup.html
已删除:accounts/tests.py
已删除:accounts/url.py
已删除:accounts/views.py
...
未跟踪的文件:
(使用“git add…”包含在将提交的内容中)
帐目/
通用应用/
有10多个应用程序,有50多个型号,等等。但是为了简单起见,我没有在这里列出它们


有没有办法撤消这些删除?这是我几个月的宝贵时间,因此我非常感谢您的帮助。

git reset--hard
将为您恢复文件。它还将删除所有暂存的更改。因此,如果您有任何需要保留的内容,请在重置之前将这些文件复制出来。

我对您感激不尽,艾伦!我正在为失去几个月的开发工作做心理准备。非常感谢。