Files
30-seconds-of-code/snippets/current-branch-name.md
Angelos Chalaris 1397bb792e Deprecate expertise
2022-12-04 22:23:55 +02:00

429 B

title, tags, author, cover, firstSeen, lastUpdated
title tags author cover firstSeen lastUpdated
Get the current branch name branch maciv blog_images/cherry-trees.jpg 2021-04-04T21:50:46+03:00 2021-04-13T21:10:59+03:00

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`