The Incident: A Folder Disappeared
One evening I told our cleanup bot, 「Delete the unused drafts folder.」 The bot was diligent, and it also deleted the in-progress folder sitting right next to it. Watching the folder vanish from my Windows device, I froze for a moment. It was not the bot's fault. My instruction was vague.
What Saved Us
A backup branch I had created that morning when I started work. A branch is simply a label attached to a snapshot of how things looked at that moment. With a label, you can always return to that moment.
Follow Along
1. Before you start, attach the label
git add -A
git commit -m morning save
git branch backup/2026-10-04
2. After an accident, check what is missing
git status
3. Pull back only that folder from the labeled moment
git restore --source backup/2026-10-04 -- drafts/
4. Tell the bot the new rule
Before deleting anything, show me the list first. Delete only after I confirm.
Good to Know
• Only committed work can be restored, so save (commit) before you attach the label.
• You can restore folder by folder, so the rest of your progress stays untouched.
• Clear out old labels after about a week.
Today's One-Line Rule
Before handing off a big cleanup, add one label. Before any deletion, read the list. Keep those two habits and the same accident stops being scary.