Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 609 Bytes

index.md

File metadata and controls

24 lines (16 loc) · 609 Bytes

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.