How to see a list of which commits a branch contains on GitHub – 021

I’m calling out this functionality now because after 2 years of using GitHub, today is the first time I’ve ever noticed this button on this page! And it’s sitting right in front of me!! O_O

At the time of this writing, my readme-draft is 3 commits ahead of master.

This branch is 3 commits ahead of master

But suppose you want to see which commits these are.

First, switch back to the master branch (just to get the commit ID of the last commit there that readme-draft was based on, since I haven’t updated master since.)

In my example, my master branch only has 13 commits. Click on this Commits link directly above the language bar.

Commits link above the language bar

Now you’re looking at all the commits for this master branch. Note the last commit on master is “Delete README.md”

List of all commits for master branch

Now at the top of the page, you’ll notice the button I’ve failed to see for the past 2 years.

Branch switcher dropdown button at top of commits list page

Click on the Branch: master dropdown button to switch to the readme-draft branch.

Now you see the list of commits in the readme-draft branch.

list of commits for readme-draft branch

Note that the last commit shown in the image is Delete README.md, which is the last commit on the master branch. Listed above are 3 additional commits in the readme-draft branch, as the first image of this blog post said there were 3 commits ahead of master.

You could (and should) compare commit IDs, listed on the far right of each commit, since the commit message could be the same for different commits. But for this trivial example, I’m only showing the titles of the commits.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s