git stash

By 2015-10-05 Programming No Comments

Have you ever come across commit objects tagged a little strange, like so:

commit e8dea0b83af409904f41070e3fdc3eeab0be4fb0
Author: mr.x <mr.x@huge-company.com>
Date: Thu Oct 1 21:58:51 2015 +0200

WIP commit

commit asdea0b83af409904f41070e3fdc3eeab0be4fb0
Author: mr.x <mr.x@huge-company.com>
Date: Thu Oct 1 21:58:51 2015 +0200

WIP. Save for quick checkout. Amend when continuing.

…which seems even more odd, since you know your coworker, whose pull request you are reviewing, usually is a nice guy, organizing his commit objects in meaningfull and well-reviewable chunks.

git stash to the rescue

Such a commit history is a good sign of somebody, who not encountered the handyness of stashing yet. After all its not exactly too prominently placed in chapter 6.3 of the git documentation. (just 0.3 chapters before the immensely popular submodules…).

However, it’s one of those features, you will use on a daily basis, once you know it. Feel free to do yourself a favour and make yourself familiar.

…..and don’t forget to tell your peer. Chances are, you won’t see those WIP commits again!

PS: Of course the given example is purely fictional! ;)

Leave a Reply