Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6842709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:08:00+00:00 2026-05-27T00:08:00+00:00

At work we are using topic branches which are integrated into a few (3)

  • 0

At work we are using topic branches which are integrated into a few (3) master branches at some point.
Now I’d like to delete all topic branches from my remote repository which have been fully integrated into a master branch. If that’s not possible, retrieving a list of local branches which have been integrated would be fine, too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:08:01+00:00Added an answer on May 27, 2026 at 12:08 am

    Another answer edited in by someone who thought it’s the best (and it looks good):

    git branch -r --merged origin/master | grep -v master | grep "origin/" | cut -d "/" -f 2- | xargs -n 20 git push --delete origin
    

    Explanation:

    • git branch -r --merged origin/master
      • -r/--remotes list the remote-tracking branches.
      • --merged origin/master only list branches whose tips are reachable from origin/master.
    • grep -v master remove any branch name containing master from list.1 -v means negative match.
    • grep "origin/" select only branches on origin remote.
    • cut -d "/" -f 2- drop the origin/ prefix
    • xargs -n 20 git push --delete origin do something similar to git push --delete origin branch-a branch-b branch-c …
      • -n 20/--max-args=20 use at most 20 arguments per command line.

    As for -n, I choose 20 just as an example. Fewer arguments will make it slower, for example -n 1 makes it delete one at a time; you have more progress hints, because it will report each time it deletes a branch. More arguments like -n 200 will make it faster (less total time), but it only reports once every 200 branches, making you think that it is frozen at first (while it is not). Tune the number to your need. If you omit this option, the default number is really large (2048 in my machine).

    1. Note that this also removes origin/HEAD -> origin/master, but you won’t want to mess with origin/HEAD anyway.

    Original answer:

    git push --delete remote topicbranch
    

    or

    git push remote :topicbranch
    

    Giving a list of branches, would be something with git branch --merged master

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I wanted to work using dates and time going millions of years into
I have a SOAP request that is known to work using a tool like,
I heard an example at work of using serialization to serialise some values for
I have read some topic regarding with my question but there code doesn't work
I'm using MALLET for topic analysis which is outputting results in text files (topics.txt)
I was using the rebasing topic branches workflow http://www.golden-gryphon.com/software/misc/packaging.html But because the local testers
I am new to jQuery and cannot get a selector to work using the
I've done a good deal of RS232 work using the .Net 2.0 serialport class
I'm trying to understand how parallelism might work using PLINQ, given delayed execution. Here
I'm trying to do a proof of concept app for my work using ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.