Skip to content

Instantly share code, notes, and snippets.

View dknathalage's full-sized avatar
:octocat:
Focusing

Don Athalage dknathalage

:octocat:
Focusing
View GitHub Profile
@dknathalage
dknathalage / terminal-prompt-git-branch-zsh.md
Created November 11, 2022 10:39 — forked from reinvanoyen/terminal-prompt-git-branch-zsh.md
Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

screenshot

Open ~/.zshrc in your favorite editor and add the following content to the bottom.

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