Skip to content

24 ways to impress your friends

Vote down?

Ed Falk

I use git professionally, and I’m here to tell you the two great secrets to using git:

1) Get a visualizer. Gitx for Mac or gitg for Linux are best. Keep it open while you’re working on anything that’s not trivial, and it will help you keep track of where you are. The difference is enormous.

2) Make temporary branches any time you’re doing something potentially dangerous.

About to do a merge, or a rebase? Or anything that makes you the slightest bit worried that you’re about to screw things up? Do this:

git branch foo

This creates a “placeholder” branch named “foo” that represents the exact current state of your workspace at this moment.

Now, no matter how badly you screw the pooch from this point forward, you can always do

git reset —hard foo

And you’re right back where you started.