Workaround to see Git submodule diff in Bitbucket pull requests

Posted on: by

Tags: bitbucket git

If you update a git submodule and send a pull request for that changeset on your project on Bitbucket, the diff in the pull request page does not show the change in the submodule commit hash. As a reviewer of the core repository in FusionCharts, I have to deal with plenty of submodule updates that do not reflect in the pull requests. You can always see the diff if you download the branch on your local machine and use git diff or a tool like SourceTree. But what if you wanted to see them live on Bitbucket?

Get the raw commit diff

The solution is to see raw commit diff on Bitbucket. A raw commit diff is the pure text output produced by running git diff on the changeset. The raw commit diff looks like this:

[caption id=“attachment_913” align=“alignnone” width=“435”]Raw commit diff of submodule update Raw commit diff of submodule update[/caption]

This is how you can get to the raw diff of a commit having a submodule change on Bitbucket:

  1. On your pull request page, head over to the “Commits” tab and locate the commit in which the submodule update was added. Go to the commit’s page by clicking on the commit hash.

At FusionCharts, we have a strict policy of committing submodule updates in individual commits, so we do not mix submodule changes with other diff. This makes submodule updates easily discoverable later on.

  1. Click the “View raw commit” link on the right hand side of the page.

  2. See the submodule diff! The lines of interest to you would be the lines that look like this:

-Subproject commit 623d25e633c6f036806f0488449e08f5f3033e5c
+Subproject commit 4fea3ad0a9b28b38ba31fbfeab4af4cd086c6dfe

The first line mentions the previous commit hash of the submodule and the second line mentions the updated commit hash which the submodule now points to.

This work is licensed under a .