Use The Reflog Please - Tumblr Posts

2 years ago

bad git tip #1

Ever feel like you want to try out a new git trick, but you're afraid it might cause some problems or break your repo somehow? Wouldn't it be great if you could track the history of your git state and revert if something went wrong?

Well, now you can, with a little trick I call git-git!

Just go into a directory with a git repository, cd into the .git folder, and run git init. Then, cd back out, and create a post-commit hook in the toplevel repository that creates a commit in git-git repository every time you commit in the toplevel repository! Now your git history is being track by git, and you have all the powerful tools that git gives you at your disposal. Never worry about doing fucked up shit in git again!

Bad Git Tip #1

Tags :