0
我不知道發生了什麼。我試圖承諾,當我去推動掌握它說我是最新的,什麼都沒有發生。我在做git commit時意外刪除了所有內容
(py35) $ git status
On branch jt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: rt/models.py
modified: rt/test_models.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
../.DS_Store
.DS_Store
rt/.DS_Store
rt/migrations/.DS_Store
rt/migrations/0005_auto_20170323_2255.py
rt/migrations/0006_department_org.py
rt/migrations/0007_auto_20170323_2309.py
rt/migrations/0008_auto_20170323_2311.py
rt/migrations/0009_auto_20170323_2313.py
rt/migrations/0010_auto_20170323_2315.py
no changes added to commit (use "git add" and/or "git commit -a")
(py35) $ git add .
(py35) $ git commit -m "edits to models, fixed up team and dept, tested with presentation and working paper"
[jt cea85b9] edits to models, fixed up team and dept, tested with presentation and working paper
Committer: Jonathan <xxxxxxxxxx>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
11 files changed, 398 insertions(+), 79 deletions(-)
create mode 100644 mysite/.DS_Store
create mode 100644 mysite/rt/.DS_Store
create mode 100644 mysite/rt/migrations/.DS_Store
create mode 100644 mysite/rt/migrations/0005_auto_20170323_2255.py
create mode 100644 mysite/rt/migrations/0006_department_org.py
create mode 100644 mysite/rt/migrations/0007_auto_20170323_2309.py
create mode 100644 mysite/rt/migrations/0008_auto_20170323_2311.py
create mode 100644 mysite/rt/migrations/0009_auto_20170323_2313.py
create mode 100644 mysite/rt/migrations/0010_auto_20170323_2315.py
(py35) $ git push origin master
Everything up-to-date
在此之後我做了一件愚蠢的,跑
git log -1
git reset --hard dd882d0aa067c60dd92610d1fa6b32548e70f596
,然後將文件改回他們在我的最後一次提交的內容。甚至改變我在IDE中打開的內容。
如何獲得我今天所做的所有更改?我知道他們在那裏,因爲當我看着/.git/lost-found/other時,他們在那裏。我不知道如何使用它們。
'得到reflog --all'給你什麼嗎?你可以結帳到更早的HEAD。看到這個[答案](http://stackoverflow.com/a/21778/1233686)。 – hurturk
那麼你使用bitbucket或github?去獲得你想要的提交,然後做git reset --hard [commit#] –
'git reset --hard cea85b9'會讓你回來。 – 1615903