til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Get Name of Current Branch

This has not been pretty in the past, but from Git 2.22 you can simply do:

$ git branch --show-current
main

Resources and References

  1. StackOverflow: “How to get the current branch name in Git?”