How to get the merge-base in a pipeline?

Hi,

I see that we have an environment variable GIT_CLONE_COMMIT_HASH to get the commit sha of the current commit, however, I’m trying to also get the sha of the merge-base commit. Typically I would do this by calling git merge-base main my/branch/ref but this isn’t working I think because Bitrise only clones the specific branch commit and not the repo itself. Is there a recommended way around this?

Thanks.

Hi @rovertsnikle , when checking out a repo’s state via the git-clone Step, the Step uses different checkout strategies based on factors like git hosting provider, incoming git event type, etc.

Depending on the concrete git checkout method different git history is available and you might need to fetch extra information from the repository to be able to determine the merge-base commit.

I would need to look into one of your builds to be able to provider more concrete help, please either attach on of your build’s URL, or contact us on our Support channel.