Skip to content

Latest commit

 

History

History

git-current-branch

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

git current-branch

Get the branch name of the current branch

Git alias:

current-branch = rev-parse --abbrev-ref HEAD

Example:

git current-branch
main

Git 2.22.0+ has the equivalent command:

git branch --show-current

Note: Git Alias has many aliases that get the branch name of the current branch. A project goal is to ensure these aliases work on older git versions. Therefore these aliases use git current-branch instead of git branch --show-current. If the two implementations ever differ, then the git built-in is correct, and Git Alias must be fixed.