git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Find/prune local branches after upstream branch is deleted?

From
Jeff King <peff@peff.net>
Date
Apr 19, 2013, 17:37 UTC
Message-ID
<20130419173717.GA26964@sigill.intra.peff.net>
In-Reply-To
<87ehe64f91.fsf@mcs.anl.gov>
On Fri, Apr 19, 2013 at 12:11:38PM -0500, Jed Brown wrote:
Show 16 quoted lines
> Consider this workflow:
> 
> $ git checkout -b my/branch
> hack, commit, ...
> $ git push -u origin my/branch
> 
> The branch gets reviewed, merged, and eventually deleted upstream.  The
> remote tracking branch gets pruned via 'git fetch --prune' or 'git
> remote prune', but that leaves my local branch with an upstream that has
> been deleted.  Is there a good way to discover this so I can prune my
> local branches?
> 
> $ git branch -vv
>   my/branch        6d32ec0 [origin/my/branch] The commit message
> 
> I can script it, but this seems like a pretty common thing.

Try "git branch --merged master" to get a list of branches that have already been merged.

-Peff
Previous: Jed BrownNext: Jed Brown
Message 2 of 5 in “Find/prune local branches after upstream branch is deleted?”
  1. Jed BrownApr 19, 2013
  2. Jeff KingApr 19, 2013
  3. Jed BrownApr 19, 2013
  4. Jeff KingApr 19, 2013
  5. Jed BrownApr 19, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.