git-check-ref-format
Validate and normalize Git reference names
TLDR
SYNOPSIS
git check-ref-format [options] refname
DESCRIPTION
git check-ref-format validates and normalizes Git reference names according to strict naming rules. This ensures branch and tag names are portable across filesystems and don't conflict with Git internals.
Reference names must not contain spaces, tildes, carets, colons, question marks, asterisks, or brackets. They cannot begin or end with slashes, contain consecutive slashes, or end with .lock. Components between slashes cannot begin with dots. These rules prevent filesystem conflicts and shell interpretation issues.
The command is used programmatically by scripts creating branches or tags to validate user input before attempting operations. Normalization removes redundant slashes and ensures consistent formatting. The --branch option interprets the name as a branch shorthand, expanding it to refs/heads/ format.
PARAMETERS
--branch
Check as branch name.--normalize
Normalize refname.--allow-onelevel
Allow single-level refs.--no-allow-onelevel
Require hierarchical refs.
SEE ALSO
git-branch(1), git-tag(1)

