Musings of a Programmer

and dad, cyclist, and whatever else I get interested in

More Thoughts on Git

Here are some more things I’ve noticed after a few more weeks with Git: Many of the articles I’ve seen comparing the various different distributed versioning systems tend to complain that Git is overly complex. And while that may be, I don’t think it’s to the point where you can’t just pick it up and start using it. Back in May, when I first started using Git on a regular basis, I had only ever used Subversion, and I was productively using Git within an hour or two. Granted, I wasn’t using anywhere near all of the features, but at least I was back to where I had been with Subversion. On top of that, every now and then, I’ll pick up a new feature of Git, that either Subversion didn’t have, or I didn’t know about. Who knows, maybe this air of complexity is left over from the days of Cogito. One of these new tricks I’ve picked up was stash. Git’s stash option gives you a way to put aside changes that you are working on, without committing or rolling back. This comes in handy when something you’re working on isn’t ready to be committed yet, but you need to make a quick change in something else. An example would be if you are working on a new feature, and all of the sudden realize that a small bug needs to be fixed in your test environment. Just ‘git stash’ to save your changes, and roll back your working environment to your current HEAD. Then fix the bug, commit the fixes and roll them out to test. After that, you just ‘git stash apply’ to re-apply your saved changes. And while I haven’t played with it much, another nice feature of stash is that git will save multiple stashes, and allows you to add comments to them so that you can more easily keep track of which is which.