Skip to main content

Fresh clone

In the same state, upstream rebuilt from scratch, a colleague clones the monorepo. The clone has no fetched refs, and the upstream no longer has the synced commit, so no fetch brings it. A pull says that first, then prints the same ways out as the monorepo that fetched the synced commit before.

Output​

setup.bash builds this state:

$ build_scenario scenario_diverged_unrelated_history

The monorepo commit a clones the upstream commit k, then b changes the folder, rebuilt as b prime on top of k, R; the upstream now has only z, T, unrelated to k, which is dashed

a (add vendor/a) cloned k (seed), the synced commit, and b (local change) changed the folder since. The upstream now has only z (brand new unrelated history). No upstream branch has k any more, so it is dashed. The monorepo still has k from an earlier fetch; a fresh clone doesn't:

$ git clone -q --no-local . ../fresh
$ cd ../fresh &&
> git config user.name Test &&
> git config user.email test@example.com
$ git splice pull vendor/a
ok vendor/a fetched
!! vendor/a: its synced commit bde4164 isn't on its upstream any more
?? vendor/a: upstream and the splice share no history -- pick a side:

# keep the upstream version, discarding local changes under vendor/a:
git rm -r -q -- vendor/a && git commit -m 'remove vendor/a'
git splice clone -- $UPSTREAM vendor/a

# OR: keep both, resolving every file that differs as a conflict:
git rm -q -- vendor/a/.splice && git commit -m 'unsplice vendor/a'
git splice clone --merge -- $UPSTREAM vendor/a

# OR: keep the monorepo version, overwriting upstream's branch:
git splice push --force -- vendor/a

!! Failed: vendor/a
[1]