In my last post I showed how we can use Git, TeamCity and Octopus Deploy to include the commit id in an Octopus Deploy release, and therefore find out exactly what code is running in your system. In this post I want to show you can use the commit ids to do a diff between what you’ve already got deployed and what you’re about to deploy, so you can be exactly sure of what you’re about to release.

First off you want to get the commit id you currently have deployed and the commit id you want to deploy and copy them to Notepad (or wherever). Next you want to run a diff between the two commits. We currently use BitBucket, so I’ll show that first, but this also works with GitHub (and it’s actually a lot easier).

BitBucket

Annoyingly, BitBucket doesn’t officially support diffing between two commits. However, looking at this issue it seems that it is unofficially supported. We can diff the two commits using the following url:

https://bitbucket.org/OWNER/PROJECT/branches/compare/COMMIT-CURRENTLY-LIVE..COMMIT-TO-DEPLOY#commits

Of course, you’ll need to replace OWNER and PROJECT with the correct values and also replace the COMMIT-CURRENTLY-LIVE and COMMIT-TO-DEPLOY with the commit ids taken from the Octopus releases. The commit ids need to be in the specified order, with the earlier commit (the one currently live) first.

Once you’ve done this you’ll see a screen with the following:

released-p2-2

This contains every commit between the two versions. Also, see where it says “Merged in PROJ-99” in the list of commits? That PROJ-99 refers to the JIRA issue that was created for that particular feature. This means we can also tell you exactly what features are about to be shipped! This is fantastic when you go a while between releases, or have many people working on the same project and it becomes difficult to know exactly what was worked on.

You can also see the diff of each file under the “Diff” tab:

released-p2-1

So, we can see every line of code that has changed between the currently live version and the version we are about to deploy. Pretty neat!

GitHub

GitHub do actually support diffing between commits. The sytnax is pretty much the same:

https://github.com/OWNER>/PROJECT/compare/COMMIT-CURRENTLY-LIVE..COMMIT-TO-DEPLOY

Here’s what you end up with once you’ve done that:

released-p2-3

(Note this is a personal project, so no JIRA issues šŸ™‚ )

Again, a nice list of commits and the diff between the two versions.

So there you go – now you can know exactly what, down to every line of code, you’re about to release.

SHARE IT:

Leave a Reply