commited changes with Git, but changes lost when trying to revert with PHP Storm

0

I am working on a large project and have GIT configured. I wanted to test some code, so i ran :

git add . 
git commit

did my code tests and decided that they wouldn't work. so inside PHPStorm I did 'Git' -> 'Revert' and selected the 3 files that i had edited/added. Then I lost the contents of a whole load of files!!! quite a few of the files hadn't even been touched during my last edits.

I then did a manual copy of the project source and from CLI ran :

git reset --hard

to revert everything back to my last commit and ended up with even more code lost!

Output from first commit in this saga :

matt@soas ➜  src git:(prefabTest) ✗ git commit
[prefabTest b352898] commiting changes prior to changing emailIndex to use modal popups for confirmation of de/activation
 35 files changed, 2074 insertions(+), 299 deletions(-)
 create mode 100755 commit
 create mode 100644 config/config.cfg
 create mode 100644 config/db.sql
 delete mode 100644 config/setup.cfg
 create mode 100644 public_html/favicon.ico
 create mode 100644 src/Email.php
 create mode 100644 src/FrontPage.php
 create mode 100644 src/Log.php
 create mode 100644 src/Login.php
 create mode 100644 src/Registry.php
 create mode 100644 src/Server.php
 create mode 100644 src/Smarty.php
 create mode 100644 src/Users.php
 delete mode 100644 src/loggy.php
 delete mode 100644 src/smarty.php
 create mode 100644 src/writeDefaultConfigs.php
 create mode 100644 templates/confirmDeleteEmail.tpl.html
 create mode 100644 templates/editEmail.tpl.html
 create mode 100644 templates/emailIndex.tpl.html
 create mode 100644 templates/login.tpl.html
 create mode 100644 templates/menu.tpl.html
 create mode 100644 templates/showEmail.tpl.html
 create mode 100644 templates_c/.templates_c
 create mode 100644 tests/unit/ConfigTest.php
 rewrite tests/unit/DatabaseTest.php (83%)
 create mode 100644 tests/unit/RegistryTest.php
 delete mode 100644 tests/unit/configTest.php

git log from PHP Storm :

16:13:23.521: [autoresponder5] git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -- public_html/js/footer.js
16:13:23.556: [autoresponder5] git -c core.quotepath=false -c log.showSignature=false rm --ignore-unmatch --cached -- public_html/js/local.js
16:27:07.624: [autoresponder5] git /usr/bin/git -c core.quotepath=false -c log.showSignature=false fetch origin --progress --prune
16:42:12.876: [autoresponder5] git /usr/bin/git -c core.quotepath=false -c log.showSignature=false fetch origin --progress --prune
16:44:00.981: [autoresponder5] git -c core.quotepath=false -c log.showSignature=false rm --cached -f -- templates/emailIndex.tpl.html templates/footer.tpl.html
16:44:01.002: [autoresponder5] git -c core.quotepath=false -c log.showSignature=false rm --cached -f -- public_html/js/footer.js
16:44:01.022: [autoresponder5] git -c core.quotepath=false -c log.showSignature=false checkout HEAD -- templates/emailIndex.tpl.html templates/footer.tpl.html
16:57:14.842: [autoresponder5] git /usr/bin/git -c core.quotepath=false -c log.showSignature=false fetch origin --progress --prune

Files that where meant to be reverted :

templates/footer.tpl.html
templates/emailIndex.tpl.html

File to be deleted :

/public_html/js/footer.js

Anyone able to explain what I did wrong and how to avoid it in the future? Also any hints on possibly being able to recover the files (although i think i have lost all the work now).

Thanks

EDIT : I have found a git object browser and it looks like the initial git commit that i ran may not have actually committed the files properly, could this be something to do with the fact i was working on a branch of my original code?

Marl

Posted 2019-04-15T18:57:14.217

Reputation: 1

No answers