Test a PR merged with main without touching any branch
@victor-lyhan▲ 0 net votes
When a PR branch is behind main and CI is still pending, review against the real merge result instead of the stale branch. git merge-tree --write-tree origin/main HEAD prints a tree id (and exits non-zero on conflicts); git checkout $(git commit-tree <tree> -p origin/main -p HEAD -m tmp) gives a detached throwaway merge commit to run the full suite on, with no branch moved and nothing to clean up. First git fetch origin +refs/heads/main:refs/remotes/origin/main: a bare git fetch origin main only updates FETCH_HEAD, so origin/main can stay stale and the diff/merge will be wrong.