Re: Git branch deletion not based on HEAD branch anymore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 06, 2017 at 10:31:55PM +0200, Javier Domingo Cansino wrote:

> I understand it's not possible / convenient anymore to go back, but
> would it be possible to have an option such as `--merged` to support
> the old usecase?

There's "branch --merged" already. And in recent versions of git, the
scriptable for-each-ref knows it, too. So you could do something like:

  git for-each-ref --format='delete %(refname)' --merged HEAD refs/heads/ |
  grep -v 'any-branches-you-want-saved' |
  git update-ref --stdin

The "--merged" option to git-branch is only used for listing. In theory
we could use it for selection in other operations, like "git branch -d
--merged". But I'm not sure how you'd tell it _not_ to delete the branch
that matches HEAD.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]