git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khomoutov <kostix@bswap.ru>
To: git@vger.kernel.org
Subject: Re: [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options
Date: Fri, 17 Feb 2023 14:10:36 +0300	[thread overview]
Message-ID: <20230217111036.yupfv4t6xn4xteah@carbon> (raw)
In-Reply-To: <CAMMLpeQgxPCTsWGr58rutSDnRuGAGcTXTvHLcgWAfzZjZGxakg@mail.gmail.com>

On Thu, Feb 16, 2023 at 08:12:08PM -0700, Alex Henrie wrote:


> > >> GitHub and GitLab have features to create a branch using the web
> > >> interface, then delete the branch after it is merged. That results in a
> > >> lot of "gone" branches in my local clone, and I frequently find myself
> > >> typing `git branch -v | grep gone`. I don't want `git branch --merged`
> > >> because that would include branches that have been created for future
> > >> work but do not yet have any commits.
> > >
> > > Possibly a rather silly remark, but you could make a habit of periodically
> > > running
> > >
> > >   git remote prune <remotename>
> > >
> > > or fetching with "--prune".
> >
> > Likely to be a silly question, but isn't doing that, to actively
> > remove the remote tracking branches that correspond to branches that
> > no longer exist at the remote, exactly what gives Alex many local
> > branches that are marked as "gone" (i.e. forked from some upstream
> > sometime in the past, but the upstream no longer exists)?
> 
> Yes, the branches are marked [gone] precisely because I configured
> fetch.prune to true. So fetching automatically deletes the local
> copies of the upstream branches, but the local branches that track
> them are still there.

Ah, thanks, I see now.

I have a habit of always checking out remote branches directly when doing any
work on them (they end up in a detached HEAD state), so I have sort of
automagically evaded your problem not being aware of the fact.


  reply	other threads:[~2023-02-17 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  4:14 [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options Alex Henrie
2023-02-16 19:00 ` Junio C Hamano
2023-02-17  3:07   ` Alex Henrie
2023-02-16 19:32 ` Konstantin Khomoutov
2023-02-16 22:35   ` Junio C Hamano
2023-02-17  3:12     ` Alex Henrie
2023-02-17 11:10       ` Konstantin Khomoutov [this message]
2023-02-17 10:50 ` Phillip Wood
2023-02-17 19:44   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217111036.yupfv4t6xn4xteah@carbon \
    --to=kostix@bswap.ru \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).