Git Internals and Plumbing/Update ref atomically

Create or move a ref directly.

Section: Refs and Symbolic Refs

Update ref atomically

bash
bash
git update-ref refs/heads/tmp <commit_sha>

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Refs and Symbolic Refs
List refs
List local refs and object IDs.
OpenIn sheetbashsame section
Format refs
Script-friendly ref iteration.
OpenIn sheetbashsame section
Read symbolic ref
Print the symbolic target of HEAD.
OpenIn sheetbashsame section
Pack refs
Store refs efficiently in packed-refs.
OpenIn sheetbashsame section
Write blob object
Store file content as a blob and print its object ID.
OpenIn sheetbash1 tag match
List tracked files
Print index entries.
OpenIn sheetbash1 tag match