Skip to content

24 ways to impress your friends

Dealing with Emergencies in Git

9 Comments

Comments are ordered by helpfulness, as indicated by you. Help us pick out the gems and discourage asshattery by voting on notable comments.

Got something to add? You can leave a comment below.

Mark Stickley

Very good, I like the analogy :)

Don’t forget, `git stash` will not stash any untracked files. If you want to clear up the untracked files in your working directory you can add the -u switch:

`git stash -u`

Aaron Bassett

you’ve probably dealt with emergencies by making a somewhat useless commit

I think this is an OK approach as well. Most people’s issue with it is that you’re left with a messy history. But you should be rebasing your feature branch before you merge back into master anyways. Simply squash those “saving state” commits.

But if you are using stash I would advise you name the stash using git stash save <message> so if you then have multiple stashes you can easily find the one you wish to apply.

Rob

Bisect is also crazy handy. One of the best troubleshooting commands in git.

http://robandlauren.com/2014/11/26/git-bisect-ftw/

André Luís

Lovely overview! Thank you. One of the discoveries that changed my life (or at least I pulled a lot of less hairs off my head) was interacting rebasing with squashing and fixing up commits.

It allows us to clean up the history of the (feature) branch before merging it into the master branch.

Makes us a lot more confident while developing knowning the history is not final.

Paul Morriss

I don’t use git enough so that I don’t need to keep on looking stuff up. I find analogies like this helpful as then I can picture what’s going on, rather than just running a command that looks like it does what I want.

Impress us

Be friendly / use Textile