GIT recover files (git reset --hard HEAD)

2

I'm a little inexperienced with GIT. I was working on a branch, however, I wanted to receive some updates in the master branch, but git pull failed, as there were non-committal changes. So I ended up using the git reset --hard HEAD command. But I had forgotten about the non-committal changes in the other branch, besides the ones I wanted to rule out. The question is, is there any way to recover such files? There are several hours of work there. If anyone can help me.

    
asked by anonymous 09.05.2016 / 01:16

1 answer

3

Not possible. According to the git reset documentation:

  

git-reset - Reset current HEAD to the specified state

Translation: moves the pointer (the HEAD ) of your last commit to the desired commit - in this case, the HEAD itself. When you run the command with the --hard option, all pending changes (also called working tree ) are discarded.

In the specific case of your problem, you could have run the git stash command to "save" your changes without necessarily committing them, downloading the changes from master , reapplying your changes with git stash apply and resolving any changes conflicts.

    
09.05.2016 / 13:19