The latest from GitHub's engineering team - The GitHub Blog logoThe latest from GitHub's engineering team - The GitHub Blog
|DevOps

How the GitHub CLI can now enable triangular workflows

2025-04-25
14 min read
0

Endigest AI Core Summary

This post explains how the GitHub CLI (v2.71.2) improved support for triangular Git workflows, including forks.

  • A triangular workflow pulls from one ref (e.g., upstream/default) and pushes to a different ref (e.g., origin/branch), unlike centralized workflows where pull and push targets are the same.
  • Git supports triangular workflows via .git/config settings: the merge key sets the pullRef, while pushremote or remote.pushDefault sets the pushRef.
  • The @{push} revision syntax (git rev-parse --abbrev-ref @{push}) lets Git resolve a branch's pushRef programmatically.
  • The GitHub CLI previously didn't fully utilize these Git config settings, causing gh pr commands to behave incorrectly in triangular setups.
  • v2.71.2 fixes this so gh pr commands now correctly read pushRef and pullRef from Git config, enabling smooth PR creation and management in forked or triangular workflows.