I use git regularly, but I am not an expert. Sometimes I want to do something very simple, and I end up executing a chain of command leading me to a point where nothing make sense anymore in my history. I don't know how this is possible, but it happened a couple of times to me.
One day was quite bad, and I thought I had lost all my work, until a colleague told me about git reflog. It an awesome command. Since I know it exists, it really eased the fear I had of loosing all my work. To make it simple, it's like a history of your branch's HEAD. So if you have done a reset --hard
, for example, the previous version of your work should still be there!
If you type git reflog, you'll get a history with some SHA reference. Then you can use those references as you would with a more "normal" flow (like reset, diff, etc.).
This is the git referenec about reflog.
Also, I found this help page about git, which is worth reading for sure. It's a "make your own adventure"kind of webpage, guiding you through your git journey.
Comments
Post a Comment