dahlbyk / posh-git

A PowerShell environment for Git
http://dahlbyk.github.io/posh-git/
MIT License
7.62k stars 802 forks source link

Bring back Get-GitBranch #935

Closed Pxtl closed 1 year ago

Pxtl commented 1 year ago

System Details

Issue Description

The commandlet Get-GitBranch has been removed from the Posh-Git exported commands list. It's still present in the repo utils but has been left out of the export script. Get-GitBranch is very useful to my workflow -- every time I push a new branch, I do

git push -u origin (Get-GitBranch)

Can this be resurrected? Otherwise is there a powershell module I should be using instead?

hmleal commented 1 year ago

In the mean time you can use something like this: git push -u origin (git rev-parse --abbrev-ref HEAD)

dahlbyk commented 1 year ago

every time I push a new branch, I do

git push -u origin (Get-GitBranch)

In the mean time you can use something like this: git push -u origin (git rev-parse --abbrev-ref HEAD)

Even better: git push -u origin HEAD!

# pnb = push new branch
git config --global alias.pnb "push -u origin HEAD"

Removing Get-GitBranch was part of a deliberate effort (https://github.com/dahlbyk/posh-git/pull/427) to reduce posh-git's surface area to tab expansion + prompt. You could use If you want PowerShell functions for Git, check out https://github.com/PoshCode/PSGit.