Dev / Git

GIT: Branch cleanup

So I was looking for a way to clean up the local branches in my repository because they seem to stack up after a few sprints.

Git Branch cleanup

My repository after several sprints.

I found a good short blog post which gave me the answer.

$ git branch | grep -v "master" | xargs git branch -D

Since we I don’t have the master branch locally and only the develop branch, I just changed it to:

$ git branch | grep -v "develop" | xargs git branch -D

Worked like a charm. Your local tree is now clean.

Photo from http://www.chesapeakequarterly.net/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s