readRemoteDefaultBranchCommit

Reads the commit SHA of the remote tracking branch for the current checkout from the local git database — no external process required.

Resolution order:

  1. The current branch's configured upstream tracking ref (e.g. origin/product-release when on a branch tracking that remote ref).

  2. origin/master

  3. origin/main

This gives the last commit that exists on the remote, which is the effective "parent" from which local analysis commits diverge.

Checks both loose ref files and packed-refs. Returns null when no remote tracking ref can be resolved.

Generated with STIG