As the title says. I put the wrong value inside a clean up code and I wiped everything. I did not push any important work. I just want to cry but at least I can offer it to you.
Do not hesitate to push even if your project is in a broken state.
Time to implement a couple forms of backups.
IN CASE OF FIRE 1. git commit 2. git push 3. exit building
“
git-fire
is a Git plugin that helps in the event of an emergency by switching to the repository’s root directory, adding all current files, committing, and pushing commits and all stashes to a new branch (to prevent merge conflicts).”git commit -m 'asdf'
I have this printed on a sign at work.
You guys don’t use a COW (copy on write) filesystem?
Version control would be quite adequate if using a sane amount of time between pushes
Except that one is automatically versioned and would have saved you this pain, and the other relies on you actively remembering to reflexively commit, and then do extra work to clean up your history before sharing, and once you push, it’s harder to change history and make a clean version to share.
These days, there’s little excuse to not use COW with automated snapshots in addition to your normal, manual, VCS activities.
I’m paranoid. I have like 5 different ways (including 3-2-1 backups) to restore everything. COW fs is great for stuff that is not a git-able project.
Sorry this happened.
Use it as an opportunity to learn how to better store and edit your code (e.g. a VCS and a smart-ish editor). For me, a simple Ctrl-Z would be enough to get my code back.
What did you learn from this?
No backup, no mercy.
git commit, git push, git out
I need a t-shirt that says this.
This is a programmers mic drop.
If you’re using vscode you might be able to look through the individual file histories to recover some work.
Sympathy upvote
Ya, push push push baby, do it on your own branch so that you can find your way back if needed.
Especially when refactoring.
I always like to say “push it to the limit” and then I have this homer Simpson with muscle body sitting on his super couch (I forgot which TV series the Simpsons made Satire of) picture in my head 🤣
Update, hah found it😁 https://m.youtube.com/watch?v=7Mhb9D35pkc&pp=ygUdc2ltcHNvbnMgcHVzaCBpdCB0byB0aGUgbGltaXQ%3D
I keep my git clone in Dropbox so I can revert accidental delete and always have the most recent code on all devices without having to remember to commit and push. If it requires manual execution I wouldn’t really consider it a proper backup solution.
I use Dropbox too. Though I have to admit, when running code you sometimes have to pause sync otherwise it interferes with code execution. But definitely worth the peace of mind. Sometimes you don’t want to commit stuff until you’re sure that it works.
I have been burnt by Dropbox in the past so now use Syncthing between my desktop, laptop, and a private remote server with file versioning turned on. Trivial to global ignore node_modules, and not giving data to a third party.
It’s saved me on several occasions.
On the bright side, you’ve now got squeaky clean disk space to fill with new projects!
F
Do you at least have some local commits to get back to? Or did your job remove the .git folder as well? 👀
also removed .git
what garbage cleanup tool gets rid of dotfiles, especially .git? if you let us know we can learn to avoid it
On top of that, the content of
.git/objects/
is write protected, so even if you gorm -r
, you’ll get an additional warning.
You have backups? Right?
Sounds like you need Jujutsu 🥰