Skip to main content

Scenario: stacked-branch

A branch stacked on a feature branch that upstream already has, and the splice didn't change on the stacked branch.

  • Monorepo (vendor/a/): feature with a local commit under vendor/a/, pushed; then the branch stacked on top, with a commit outside vendor/a/ only.
  • Upstream: main, and feature from the push.

Upstream has no stacked branch, so git-splice compares with upstream's default branch, as a PR from stacked would. main lacks the commit from feature, so the splice counts as new, and push creates stacked upstream at the same commit as feature. A PR from it into main would show the same change as the PR from feature; one into feature would be empty. That's the cost of comparing with the default branch (#150): pushing only the splices that changed on stacked, here none, avoids it.

Output​

setup.bash builds this state:

$ build_scenario scenario_stacked_branch
$ git splice status
On branch stacked

new, ahead 1 vendor/a push creates the branch
$ git splice log
=== vendor/a (upstream has no 'stacked' branch -- compared with 'main')
< e859a6b local change (Test <test@example.com>)
$ git splice push vendor/a
?? vendor/a: upstream has no 'stacked' branch yet -- this push creates it
ok vendor/a: pushed e859a6b to stacked
$ git ls-remote --heads "$UPSTREAM"
e859a6b3f55b1e873e69f2dc39247c735e67df6a\trefs/heads/feature (escaped)
bde416459fbcc09c9b585f3b65a94cab3f68bfcd\trefs/heads/main (escaped)
e859a6b3f55b1e873e69f2dc39247c735e67df6a\trefs/heads/stacked (escaped)