Files
30-seconds-of-code/snippets/current-branch-name.md
Isabelle Viktoria Maciohsek 897bdb23d1 Add current branch name
2021-04-04 21:50:46 +03:00

306 B

title, tags
title tags
Get the current branch name branch,beginner

Prints the current branch name.

  • Use git rev-parse --abbrev-ref HEAD to print the name of the current branch.
git rev-parse --abbrev-ref HEAD
git checkout patch-1
git rev-parse --abbrev-ref HEAD # Prints `patch-1`