Heroku differ: see which commits would be deployed

developer tools

Before pushing to Heroku, I’d like to know what will be in the release. Let’s use the power of git to answer this question.

The script I created is the following, I’ll go over it, argument, by argument below.

#!/bin/bash

git log —first-parent heroku/master..master —abbrev-commit —date=relative —format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'

Firstly the output looks like this:

~/Sites/project (master) -> bin/heroku_diff.sh
3820f5782 - (10 hours ago) Merge pull request #1331 from Project/tech/heroku-differ - Achilleas (HEAD -> master, origin/master, origin/HEAD)
996c35a69 - (10 hours ago) Merge pull request #1307 from Project/feature/get-go-leads-form - Other Dev
996c35a69 - (12 hours ago) Merge pull request #1234 from Project/feature/some-feature - Other Dev
~/Sites/project (master) ->

So how did we end up here?

Firstly, let’s check out a project I can use without worrying about sharing things I shouldn’t, I will use the rails codebase for this. In order to have a nice diff, I looked up a PR by David Heinemeier Hansson (DHH), that is about building “a web interface for developing Rails itself. … like with the mailer previews, and now in Rails 6, with the Action Mailbox inbound emails processing.”. Sounds cool, whatever that means, most importantly for us though, it has a few commits that aren’t in the main branch yet. So let us pretend the `conductor

I started out by looking up how to show the commits that are in one branch and not in the other:

~/Projects/rails (conductor6) -> git log main..conductor6
commit 398053bbd7d481ff16cb3fbeeb5fe039fc302fae (HEAD -> conductor6, origin/conductor6)
Merge: c319e5da8d 93dbbe3a81
Author: David Heinemeier Hansson <david@loudthinking.com>
Date:   Wed Mar 27 16:49:23 2019 -0700

    Merge branch 'master' into conductor6

commit c319e5da8d3b647f400f4e004b8d7875e9e0768f
Merge: 00297b1891 a04a757e5d
Author: Prathamesh Sonpatki <csonpatki@gmail.com>
Date:   Tue Mar 12 17:40:35 2019 +0530

    Merge branch 'master' into conductor6

commit 00297b18913990af8473d11a3416394bc7e902d8
Merge: 08cfdd94f1 b4bb0c3f5c
Author: Kasper Timm Hansen <kaspth@gmail.com>
Date:   Tue Mar 12 10:30:01 2019 +0100

    Merge pull request #35580 from prathamesh-sonpatki/conductor6-fixes

    Fix failing tests
#..... etc

Ok, that looks good and it seems to be correct.