How can take file back after delete before commit Because i have a mistake that is delete whole current file
Asked
Active
Viewed 33 times
-1
-
1Welcome to Stack Overflow. I do not understand what you are trying to ask. Please take some time to [edit] your question so it is more clear. Be sure to use complete sentences. Often several short sentences are easier to understand than one long sentence. – Code-Apprentice Aug 01 '18 at 04:45
-
sorry guys, because now i'm so crazzy. Now my effort has gone i dont know what to do – vân tang Aug 01 '18 at 04:49
-
Was this file ever committed previously? Did you delete a file which is already tracked by version control with git? – Code-Apprentice Aug 01 '18 at 04:50
-
"*before commit*"? What commit? – melpomene Aug 01 '18 at 04:56
-
actually not a file that's a lots of files – vân tang Aug 01 '18 at 04:56
-
that's mean you still not commit and then you delete some file but that's file its not on git server – vân tang Aug 01 '18 at 04:58
-
What do you mean by "git server"? – melpomene Aug 01 '18 at 04:59
-
sorry, my english is not good thats not in log – vân tang Aug 01 '18 at 05:02
1 Answers
1
after I code but I commit in branch b, but I want to push in branch a
If you did commit, check git reflog
: you will find your past commits there.
If you added the file to the index, but deleted it before a commit, you might be able to find it back using git fsck --lost-found
.
But if it was deleted before ever being recorded by Git... check out editor/IDE. Some have a local history which could have recorded a version of that file.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
that's up to your editor to support. i find in history file. but it's just very less. almost just a little bit tiny. Hope that helpful!! – vân tang Sep 10 '18 at 10:18