Skip to content

Instantly share code, notes, and snippets.

@guyhughes
Last active July 17, 2024 00:43
Show Gist options
  • Save guyhughes/67e326d9fd748f33b74c376f1f4dd513 to your computer and use it in GitHub Desktop.
Save guyhughes/67e326d9fd748f33b74c376f1f4dd513 to your computer and use it in GitHub Desktop.
list git branches porcelain
git branch --list -q | sed 's/[\*\ ]*//g'
@vors
Copy link

vors commented May 20, 2022

If you want to handle worktrees as well

git branch --list -q | sed 's/[\*\ \+]*//g'

@Achllle
Copy link

Achllle commented Jul 17, 2024

git only: git branch --format='%(refname:short)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment