Right way to update branch after git commit-tree
05:48 18 Jul 2026

I am doing some low-level repo construction for which git commit-tree appears to be the right tool for the job. (Specifically, I am constructing merge commits "by hand", with merged working files derived elsewhere, as if from another SCM, i.e. not due to git actually merging anything.)

git commit-tree is doing what I want, except that it does not update the current branch ref to point to the new commit it creates. Currently I'm capturing the hash emitted by git commit-tree and writing it to .git/refs/heads/branchname, but this feels risky and excessively low-level. Is there a way to get git commit-tree to do this automatically? Is there some other low-level git "plumbing" utility to do that in a slightly more controlled way?

git commit