Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Kimmax109877yFirst of all - make a copy of the folder containing the git repo, so you can't fuck it up more. Secondly: Did you use git revert? If so that just should be another commit in your history
-
@Kimmax i tried with recuva, but no success.. I also.. Smart me.. Undid my last change of the commit so the "revert" isn't listed in my git status or checkout.
+ never pushed any commits to that repo -
Shodan4987yIf reverting the revert doesn't work, and git reflog and git fsck show nothing, I'm not sure how to go about this. Try reading up on those commands. A revert is supposed to create a new commit, so I would expect something to be recoverable somehow.
I did a similar blunder but with git reset before committing anything, so I couldn't manage to salvage anything in that case. It taught me the reason why the initial commit is usually a basic README.
I understand the frustration you must be feeling right now, but don't lose hope yet. -
@Shodan yeah I had a commit doing the revert changes in my history, but I saw my files dissapear, so.. smart me, did an undo of that revert commit, but then it got deleted from my commit history, but it didn't put back my files and now, because there were no pushes, i only have a blanc, fresh repo with only the readme file :D so.. I already gave up, said to my coworker that I'm going home..
-
Voxera113977yMaybe a program to rescue deleted files if nothing else works. Most os does not overwrite deleted files directly.
Could be messy but may be possible. -
@Voxera That was my first attempt/reaction. I recovered two small files from that project, all the rest was within a half hour overwritten (due to the ssd I guess)
-
Got my file contents back! :D Checked the .git/logs/HEAD file. Saw my commit hashes. Did a "git show" in the terminal with that specific hash and it showed all green text of my initial code before the revert and such. Just created the empty files and copy-pasted it, removed the "+" signs and tadaa :D Created a new commit and pushed it immediatly.. "Shame" that an undo of a revert doesn't re-create the files it deleted locally.
Related Rants
-
cdrice105"You gave us bad code! We ran it and now production is DOWN! Join this bridgeline now and help us fix this!" ...
-
sasikanth28A group of wolves is called a pack. A group of crows is called a murder. A group of developers is called a m...
-
gggggggggg19"Whenever I see a door that says push I pull first to prevent conflicts"
FML..
I worked directly in my Github repo folder while working on a project (don't ask me why). I did my initial commit with all my code from the start until 5 hours ago. I never pushed.. A minute ago, I checked my commit and noticed that there were DB credentials in one of the files. So.. Smart me.. "revert commit"..
Result. Everything got deleted except my node_modules folder and the readme file.. I lost everything.. Fuck me, I'm going home..
Please, someone.. Can I get these files back via git or something? Can't find anything in in the history..
rant
git
revert
lost 5 hours of work
fml