Improving My Git Workflow

Through various projects I’ve been working on in the last couple of years I’ve been digging deeper into Git. While many of Git’s basic operations are pretty straightforward, for someone getting used to Git it soon becomes apparent that some operations aren’t as simple as one might first expect, especially when using Git on the command line rather than with a GUI client.

I’ll expand on the topic later, but I wanted to create this stub article pointing to the GitHub repo I published a few days ago. It contains my annotated Git aliases (many of which I use as a quick reference as I haven’t yet committed all of them to memory), and a collection of helper scripts, many of which I have written myself, while few others, like git-wtf, I have not, but have included them for convenience. Also check out the README in the repo for alias dependencies and for other favorite Git extensions I frequently use.

Besides the enhanced Git command line, gitk with its visual blame tool (accessible from gitk, and also directly from the command line with gui blame when gitk is installed), Atlassian SourceTree, Scooter Software’s BeyondCompare (for diffs and merges), and tig for repository viewing on the command line are now solidly part of my everyday Git toolkit.

Update 2016-12-26: If you like to use a graphical Git client, be sure to check out the awesome GitKraken (Windows/macOS/Linux, free + pro subscription). Tower is now also available for Windows, but with GitKraken having established itself, it’s now too little too late, especially for the Windows users who previously didn’t have a really good GUI Git client (Atlassian SourceTree is ok, but not really stellar).

Workflow discoveries

It’s interesting how, every now and then, I come across some really obvious improvement to my workflow, even though that “fix” has been sitting – literally – under my nose all along. Here’s an example: today I was researching a better way to organize lengthy CSS files in an attempt to decide whether I should mix, in the list, classes and IDs, or separate them categorically as some classes are “localized” to a repeating structure on the page and work alongside a specific ID/IDs.  To this end I was reading through comments for a stop design blog post  “CSS organization tip 1: Flags” and finally reached comment #49 written by “Ridge” about three years ago: »Ah, the joy of a keyboard with a number pad. “/” and “*” are right next to one another. Quick two-finger ‘da-dum’ on the keys, and we’re away…»

Blink.  I’ve always found cumbersome to hit shift-7 shift-‘ (I use Finnish/Swedish layout keyboard) to produce “/*”, and then few moments later the same in reverse to close the comment tag.  And all along – now at least for couple of years – I’ve used a keyboard with a slash and asterisk sitting next to each other atop the number pad.  Ah, so obvious!

As for the CSS organization, I think I’ve decided to create three groups: tag definitions (‘body’, ‘p’, ‘div’, etc.), generic classes (used over and over again around the page/site), and IDs mixed with definitions for classes (e.g. “.someLocallyUsedClass”) and tags (e.g. “.someLocallyUsedClass a”) that only appear in association with the ID such as wrapper content. In the past I’ve divided classes and IDs categorically, only to have to jump around in the CSS file when editing a specific area of the page that utilizes, besides some IDs, one or more local tags or classes.

Powerful clip-board macros with AutoHotKey & TextPipe Pro

I posted on the DataMystic forums (manufacturer of TextPipe Pro) a brief tutorial on how to create powerful clip-board macros with help of TextPipe Pro and the free hotkey utility, AutoHotKey – two utilities from my standard toolbox.

Clip-board macros with TextPipe and AutoHotKey