Re: [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options
- From
Alex Henrie <alexhenrie24@gmail.com>
- Date
- Feb 17, 2023, 03:12 UTC
- Message-ID
- <CAMMLpeQgxPCTsWGr58rutSDnRuGAGcTXTvHLcgWAfzZjZGxakg@mail.gmail.com>
- In-Reply-To
- <xmqq1qmpp7bh.fsf@gitster.g>
On Thu, Feb 16, 2023 at 3:40 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> > Konstantin Khomoutov <kostix@bswap.ru> writes: > > > Alex Henrie <alexhenrie24@gmail.com> writes: > > > >> 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.
-Alex