This blog post is inspired by positive feedback that I received during one of my talks.
I have been giving presentations and public talks since my second day at work. Literally, I gave a presentation on LINQ-to-SQL at a training facility fresh out of school thanks to my expertise gathered during working on my final paper. As I was showing how powerful LINQ-to-SQL was, there was quite some code involved.
Over the following years, plenty of public talks with code followed. And a decade ago it was still ‘cool’ to show your coding skills on stage and do live code demos. Over the years, others and myself started experimenting with code snippets to speed up the process. I have even seen speakers create their own custom code snippet tools, personally I stuck to the code snippet functionality available in Visual Studio.
But over time, I started to get frustrated with losing time on typing errors, I’m not used in typing on tiny standing desk, or forgetting part of the solution because of time constraints. And how many times have you been in a talk where the audience pointed out a forgotten semicolon or parameter resulting in a build error? So I decided I needed another solution to improve my talks.
Thankfully we have git to help us out these days, which works a lot easier for this case than many of the older centralized version control systems. Personally I have always been more of a UI person than a CLI person. I skipped the early days of git as I was still on SVN and TFS, but I started using git when visual tools became available. I tried a few, but I quickly settled on GitKraken which was still in beta back then. Since then I have been a big fan of the tool and been promoting it in my teams.
So how do I use git and GitKraken to improve my talks? First of all, I prepare my demos in multiple steps where each demo step is a separate commit. The repository of our Akka.NET talk clearly shows these steps, but all my talks in the last 5 years follow this pattern. With all the commits prepared, I’m ready for my talk and as a bonus I have all my code available to share after my talk.
During my talk I’m switching between my commits. I can go through all the changes in the demo step and I’m sure that all code is in place and everything builds and runs (except for maybe internet connectivity or similar). But instead of copying over commit hashes, I’m using GitKraken as visual tool to quickly switch.
Simply right-click any of the commits and click ‘checkout this commit’ and you’re set. Messing around too much can bring you in a detached head state, and if you google for ‘detached head’ then you’ll find out how many developers struggle with it. I probably would as well if I was using command line. Instead I simply right-click on any commit and I’m able to switch again.
An extra bonus is being able to switch between commits and choose between keeping or discarding changes. This is sometimes useful during a talk, but even more during the preparation of the talk. It happens from time to time that you’re forgetting a piece of the last demo step, which you can amend, but sometimes you have to jump back a few steps. You can start messing around with branches, cherry picking etc. but I simply use soft resets and stashing to set aside my more recent commits and fix the one that missed some code. Afterwards I replay my stashes and commit my changes again, verifying on every single step that everything works as desired.
There are several other tricks worth mentioning, but I might save them for another blog post. I hope that this post helps you out for your next presentation or even your regular job. There’s no need to struggle with git. Other visual tools might have similar capabilities, so if you’re already using another tool make sure to check.
Disclaimer: I am a GitKraken ambassador since a few years, but I have been using GitKraken since it was beta. Up until today it is my primary git tool, I even jump out of Visual Studio for my git-related tasks.