Skip to content

Instantly share code, notes, and snippets.

@Bak-Jin-Hyeong
Last active September 2, 2022 01:25
Show Gist options
  • Save Bak-Jin-Hyeong/894853010eac6585d4e4be4d4e54c6e7 to your computer and use it in GitHub Desktop.
Save Bak-Jin-Hyeong/894853010eac6585d4e4be4d4e54c6e7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env pwsh
git branch --format "%(if:equals=*)%(HEAD)%(then)%(refname:short)`t%(upstream:short)%(end)" | `
Where-Object { $_.Length -ne 0 } | `
ForEach-Object { $s = $_.Split("`t"); @{'branch'=$s[0]; 'upstream'=$s[1] } } | `
ConvertTo-Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment