Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Cleaning old branches

John Barker
Thursday, October 11, 2012

We’re using Github pull requests on our project. Which means whenever a pull request is accepted, a branch is left lying around.

So I wrote a quick script to remove all remote branches that have been merged into develop (our working branch, you’ll have to alter the first instance of ‘develop’ to master if you use a more typical git branching model).

Here goes:

git branch -r --merged develop | sed 's/ *origin///' | grep -v 'master$' | grep -v HEAD | xargs -n 1 printf "echo git push origin :%sn" | bash
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

John Barker

John Barker
New York

Recent Posts

  • Ahead of the curve
  • Letter to myself as a junior developer
  • Start small and compose: A strategy for using FactoryGirl
Subscribe to John's Feed

Author Topics

advice (1)
blame (1)
code (1)
principle (1)
factories (1)
factory_girl (1)
ny (4)
nyc (3)
ruby (2)
testing (1)
composition (1)
fp (2)
functional (2)
future (2)
inheritance (1)
mutability (1)
performance (2)
programming (2)
rant (1)
clojure (1)
lisp (1)
scala (1)
devise (1)
facebook (1)
google+ (1)
oauth (1)
git (1)
bundler (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >