0

Right now, my project (VCS: Git) has quite a few branches that haven't been touched in months. With the dynamics of this project, any branch that hasn't been updated in the last 2 months is decidedly out of date and no longer relevant.

Is there a way to prune these in bulk, given some "hasn't been touched in..." threshold?

Alec
  • 1,986
  • 4
  • 23
  • 47

1 Answers1

-1
git branch
git checkout master
git branch --merged
git branch -d old-merged-feature
git branch --no-merged
git branch -D old-abandoned-feature
git remote prune origin

More compact:

comm -12  <(git branch --merged|awk '{print($1)}') <(git branch -r --merged|awk '{print($1)}'|awk -F \/ '{print($2)}')

See 1

Also try this answer: https://stackoverflow.com/a/21304578/4274360

oginski
  • 354
  • 5
  • 16