DEV Community

Discussion on: Spooktober: Git Horror Story

Collapse
 
thomaswdmelville profile image
Thomas Melville

I've been working with git for 6 years now and I've had some major nightmares over the years. Hours or days of code gone in one swift enter key stroke.

I've learnt one git command that's since saved me from those nightmares:


git reflog 

It keeps a local history of all the changes to a repo. So even if you screw up your branch, the commit is still there and can be found and restored using reflog.