Who doesn’t love bringing things back to life?!?!
Now my third non-language micromaterial, this one focuses on recovering a deleted local branch in git.
Essentially if you have some work that you’ve completed and pushed somewhere remotely (or it’s stored on someone else’s computer), then you can always get a copy of the work back.
The situation I ran into was that I had a bunch of work I need, but it had only ever been on my local computer. I got a bit overzealous with cleaning up unused branches, and before I knew it, I had deleted the branch that I actually needed!
This is my favorite use case for the reflog.
We’ve got a list of all the previous “moves” in our local git project, so just find the one you want, and go back to it.
There isn’t any code checked into the project repo, just the documentation to take the learner step-by-step through the process. Like rebasing, the reflog is something that seems scary/advanced/arcane until you actually just use it a few times.
What is unfamiliar is difficult. What is familiar is easy.