Skip to content
The Git Crypt

/static/cripta/en/ossada/update-ref/

Menu

GIT-015 · Plumbing

git update-ref

Moves a reference by force — the lever branch and tag pull under the hood.

A branch is just a file with a hash inside, and update-ref is the official tool for writing it: it points refs/heads/experimento at any commit, creates references outside refs/heads/, deletes with -d — all while recording the change in the reflog, which no manual file edit does.

It is the backstage lever: branch, tag and commit itself pull it underneath. In the hands of automation writers — or of anyone rescuing a commit found by fsck — it gives a name to any bone in the vault.

$ git update-ref refs/heads/experimento 9e4d7b1
$ git branch --points-at 9e4d7b1
  experimento
A loose commit, christened a branch by the lever.