3 ms·
`git branch` also determines whether your working tree is modified. This can be extremely slow on large repos. `git rev-parse --abbrev-ref HEAD` is very inexpe
by lunixbochs 11y ago
`git branch` also determines whether your working tree is modified. This can be extremely slow on large repos.
`git rev-parse --abbrev-ref HEAD` is very inexpensive in comparison, and doesn't print anything extra you might need to parse out if you're in a shell script.