-
-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove remote merged branches command #79
Comments
Sure! I've actually had the following in my own profile for some time and was considering adding it to posh-git... function Delete-MergedBranches ($Commit = 'HEAD', [switch]$Force) {
git branch --merged $Commit |
? { $_ -notmatch '(^\*)|(^. master$)' } |
% { git branch $(if($Force) { '-D' } else { "-d" }) $_.Substring(2) }
} |
I have one that works without PS in pretty much any shell. :) But it doesn't prompt you. That's one thing ours does that's nice. It lists them out and prompts you. |
Prompts to force delete, you mean? Out of curiosity, have you tried |
Are you wishing for a |
@dahlbyk I have not. It just prompts you before it chooses to delete the remote branches. ^^^ Here's a screenshot. Unfortunately I only have one branch that needs to be cleaned so it doesn't show you how it might normally look. But you get the idea. We show you the list. We prompt you to delete. |
If the branches have already been merged, I'm curious why you default to requesting confirmation? I'd tend to flip it around and offer a |
Because I'm paranoid. :) A |
Git's pretty good about only doing things that are safe... I figure |
And -Confirm. -J on a phone.
|
What's the status of the issue? |
@haacked do you still have your function handy? |
Would you want the default branch to always be master, or the current branch? |
Defaulting to |
Have @dahlbyk or @JayBazuzi reviewed the pull request (#159) by @tkirill ? |
@bcdady Glad to see there is someone else who interested in this functionality! I've already thought no one need this. These cmdlets are fully tested at this moment. We use them in our team daily and never had a single problem or crash. |
Not sure if this command should require confirmation by default. Perhaps we also need a Remove-GitBranch command which would need confirmation.
Not sure if this command should require confirmation by default. Perhaps we also need a Remove-GitBranch command which would need confirmation.
Fix #79 - add Remove-MergedGitBranch command
So we (GHfW) team have a PowerShell script that will list all remote branches that are already merged into a specified branch (it defaults to origin/master if no branch is supplied) and offer to delete them for you.
I'd love to clean it up and add it as a command to
GitUtils.ps1
. Would you be interested in such a thing as part of Posh-Git?The text was updated successfully, but these errors were encountered: