I have been working on an add-on for this big commercial product (that ships source code). This add-on I am developing is located within the folder:
~/dev/project/addons/my_addon
To keep things maintainable I created a git repo in this folder. I worked and saved the most import things with a git commit.
Yesterday evening I was missing a feature within the core product, this I thought I could build this myself and send them the patch. This I did:
cd ~/dev/project
git init
git add *
git commit -m 'init'
I thought this would be nice, since if I would accidentally make the program crash I could just git reset --hard
and for the creation of the patch file I could just git patch.
Yesterday I worked for 6 hours to include this patch and in the meanwhile I did some coding in my own add-on. This morning I made a big error. I wanted to reset the changes I made within the project folder. But I did this within my add-on, I've lost over 30 hours of work.
Within ~/dev/project
I have the following git history:
stolas@dev-laptop:Commercial_License_3.73% git log
commit 40f4059dd05311997b5093077e69e89535b1ecb6
Author: Stolas <stolas@my_domain.org>
Date: Fri Apr 25 23:31:57 2014 +0200
init
stolas@dev-laptop:Commercial_License_3.73% git reflog
40f4059 HEAD@{0}: checkout: moving from master to 40f4059
40f4059 HEAD@{1}: reset: moving to 40f4059
2f1ce07 HEAD@{2}: commit: stash, I want my **** files back
40f4059 HEAD@{3}: commit (initial): init
stolas@dev-laptop:Commercial_License_3.73% git status
HEAD detached at 40f4059
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)
(commit or discard the untracked or modified content in submodules)
modified: addons/my_addon (new commits, modified content, untracked content)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.history
Sessions/25042014.log
Sessions/25042014--23_36_16.log
Sessions/26042014--00_17_28.log
no changes added to commit (use "git add" and/or "git commit -a")
stolas@dev-laptop:Commercial_License_3.73%
Where within my ~/dev/project/addons/my_addon
I have got the following git history:
stolas@dev-laptop:my_addon% git log
commit eff5291b50ad09970c6386ef4deaa70f6e8a0270
Author: Stolas <stolas@my_domain.org>
Date: Sat Apr 26 08:27:34 2014 +0200
Revert "Revert "First setup nearly done.""
This reverts commit 6567b65523898e625b8ded8b058885ca51f2aae4.
commit 6567b65523898e625b8ded8b058885ca51f2aae4
Author: Stolas <stolas@my_domain.org>
Date: Sat Apr 26 08:27:14 2014 +0200
Revert "First setup nearly done."
This reverts commit b3c55d3f736f15c78f71ada5f0bf5ae46cf8dd71.
commit b3c55d3f736f15c78f71ada5f0bf5ae46cf8dd71
Author: Stolas <stolas@my_domain.org>
Date: Wed Apr 23 22:48:39 2014 +0200
First setup nearly done.
commit b8c234a4cf52e89367d49788594442d8142624d8
Author: Stolas <stolas@my_domain.org>
Date: Sat Apr 19 09:01:36 2014 +0200
Start Env
commit cc4d0b7add2ed852043e549716481207ec7ef13b
Author: Stolas <stolas@my_domain.org>
Date: Sat Apr 19 09:00:24 2014 +0200
Start Envoirment button
commit 92a2ac263b58adf8265d8edb4e14c075ee7b0ad1
Author: Stolas <stolas@my_domain.org>
Date: Sat Apr 19 08:58:13 2014 +0200
Setup
stolas@dev-laptop:my_addon% git reflog
eff5291 HEAD@{0}: reset: moving to HEAD^
11bce53 HEAD@{1}: commit: dialog
eff5291 HEAD@{2}: revert: Revert "Revert "First setup nearly done.""
6567b65 HEAD@{3}: revert: Revert "First setup nearly done."
b3c55d3 HEAD@{4}: commit: First setup nearly done.
b8c234a HEAD@{5}: commit: Start Env
cc4d0b7 HEAD@{6}: commit: Start Envoirment button
92a2ac2 HEAD@{7}: commit (initial): Setup
stolas@dev-laptop:my_addon% git status
On branch master
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: libs/my_addon_main.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
libs/my_addon_paint.py
libs/my_addon_msging.py
template/dialog.xml
no changes added to commit (use "git add" and/or "git commit -a")
I thought I could fix this by making a checkout on the lower git for the init commit, but it seems to reset everything except my git folder. How can I reset a git within a git to the yesterday? Or revert my revert(s)
The file I desperately want back is libs/my_addon_main.py
as most of the work is within this file.