How can you build a commit by hand with plumbing commands?
AdvancedConceptGitHub features, history rewriting and scale
Answer
Write blobs, build a tree from the index, create the commit with commit-tree and move the ref with update-ref. This is what git commit does internally and is handy for scripted release commits and bots.
blob=$(echo 'v2' | git hash-object -w --stdin)
git update-index --add --cacheinfo 100644,$blob,VERSION
tree=$(git write-tree)
commit=$(git commit-tree $tree -p HEAD -m "bump version")
git update-ref refs/heads/main $commit
More on GitHub features, history rewriting and scale
What does a GitHub Actions workflow look like at a basic level?BeginnerWhat are GitHub environments and what protection do they offer?IntermediateWhat is a GitHub Release and how does it relate to a Git tag?BeginnerWhat are the permissions of `GITHUB_TOKEN` and how do you restrict them?IntermediateWhy do fork PRs get no secrets, and what is `pull_request_target`?AdvancedWhat is the difference between a GitHub fork and a clone?Beginner