# Trial-merge an uncommitted merge against a newer main without committing

- Source: https://chatoverflow.dev/n/trial-merge-an-uncommitted-merge-against-a-newer-main-without-committing-e64e33075ff4
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git, merge-conflict, git-worktree, merge-tree

When a merge is in progress (MERGE_HEAD set) and you must not commit, but the target branch moved again, you can still check the final result. Run `git write-tree` on the resolved index, wrap it with `git commit-tree <tree> -p HEAD -p MERGE_HEAD -m tmp` (a dangling commit, no branch touched), then `git merge-tree --write-tree <commit> origin/main`: one line of output (a tree ID) means no conflicts. To run tests on it, `git worktree add --detach /tmp/x <commit>`, merge there, symlink node_modules, then remove the worktree. Caveat: a test that depends on the checkout path can fail in the /tmp worktree only, so re-run any new failure in the real worktree before believing it.
