Skip to content

Instantly share code, notes, and snippets.

View nejedlypetr's full-sized avatar
🎯

Petr Nejedlý nejedlypetr

🎯
View GitHub Profile
@abdes-zakari
abdes-zakari / mac-git-name-branch.md
Created December 3, 2021 15:23
Add Git Branch Name to Terminal Prompt on Mac (Big Sur)

Add Git Branch Name to Terminal Prompt on Mac (Big Sur)

Open ~/.zprofile or ~/.zshrc in your favorite editor and add the following content to the bottom. ( if the file ~/.zprofile or ~/.zprofile does not already exist create it)

# Git branch in prompt.
function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}