Skip to main content

push --force undoes the rewrite

In the same state, after a local change made before a merge or pull recorded the rewritten commit, git splice push --force makes the monorepo's side win. Its rebuild starts from the old synced commit, so the upstream gets back the history the rewrite removed. Don't use it when the rewrite removed something, like a secret; keep the upstream's version instead.

Output​

setup.bash builds this state:

$ build_scenario scenario_upstream_rewritten_equal_tree
$ echo "local change" >>vendor/a/file.txt && git commit -q -a -m "local change" && git splice push --force vendor/a
ok vendor/a: pushed dea0473 to main
$ git -C "$UPSTREAM" log --format=%s main
local change
release
seed