Reputation: 341
I have no idea what happened. I tried to commit, and when I went to push to master it said I was up to date and nothing happened.
(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
After this I did something dumb and ran
git log -1
git reset --hard dd882d0aa067c60dd92610d1fa6b32548e70f596
Which then changed the files back to what they were at my last commit. Even changing what I had open in my IDE.
How can I get all the changes I worked on today back? I know that they are there because when I look in /.git/lost-found/other, they are there. I'm not sure how to use them though.
Upvotes: 0
Views: 415
Reputation: 5454
Following command may recover by pointing HEAD to previous commit:
git reset --hard HEAD@{1}
Please make a backup copy of the entire project directory before typing this just to prevent any confusion for the solution.
Upvotes: 2