Git Diff for Commit



GitPitch provides a powerful markdown widget that can be used to generate and render a diff for any commit on any repository on github.com.

Currently this feature is GitHub only. Generating diffs for content on GitLab and Bitbucket is not supported.


Diff for Commit within any GitHub Repository

To render a diff for a commit within any repository on gitpitch.com you can use the following widget syntax in your PITCHME.md markdown file:


@diff[class...]($user/$repo/$commit)

Substitute the GitHub account name, repository, and commit hash for $user, $repo, and $commit respectively.

The use of class… properties on this markdown widget is optional. When used to control the appearance of this widget on your slides, one or more property values can be specified within the square brackets.

For example, to generate and render a diff for a selected commit on the Vue.js repo use the following snippet:

---?color=#333

@diff[span-100 zoom-09](vuejs/vue/e7d49cdcf2fd9a612e0dac7a7bea318824210881)

This markdown snippet renders as follows:

GIT-DIFF-EXTERNAL

You can see the original GiutHub diff for this commit here.

By default, GitPitch automatically activates live code presenting for the diff output. This allows you to instantly step-through the individual changes on each file modified by the corresponding commit. If you want to disable this feature, for example, in order to customize the live code presenting steps or annotations, see Disable Automatic Code Presenting on Diff.


Diff for Commit within the Presentation Repository

To render a diff for a commit within the repository that contains the GitPitch slide deck you can use the following widget shortcut syntax in your PITCHME.md markdown file:


---

@diff[span-100]($commit)

Substitute the GitHub commit hash found in the presentation repository for $commit.


Disable Automatic Code Presenting on Diff

By default, GitPitch automatically activates live code presenting for the diff output. This allows you to instantly step-through the individual changes on each file modified by the corresponding commit.

But if you want to disable live code presenting, simply set the nofrags style as a property value for the markdown widget as follows:

---?color=#f8f8f8

@diff[span-100 nofrags](onetapbeyond/gen_metrics/3e9f2100269b9f5f2fd98975bd417089183ddcf2)

This markdown snippet renders as follows:

GIT-DIFF-NO-FRAGS

If you use nofrags to disable automatic live code presenting, you can then add your own custom code fragment markers. For example:

---?color=#f8f8f8

@diff[nofrags](onetapbeyond/gen_metrics/3e9f2100269b9f5f2fd98975bd417089183ddcf2)

@[1](Git Diff generated for changes to PITCHME.md)
@[9](This commit involved a single change to this file)


Offline Git Diff Support

Git Diffs are dependent on content served by github.com. As such, if you are developing or presenting a slide deck when offline the content of the diff will not be available for rendering on your slide.

GIT-DIFF-NOT-AVAILABLE

GitPitch attempts to handle this gracefully by automatically replacing the fully rendered diff with a simple message indicating that the diff is not currently available. Once Internet access has been restored, the fully rendered diff will be displayed once again.