arc90 / git-sweep

A command-line tool that helps you clean up Git branches that have been merged into master.
MIT License
2.55k stars 125 forks source link

Would like a way to clean only local branches #5

Open marc2982 opened 12 years ago

marc2982 commented 12 years ago

Hi guys,

Could functionality be added to clean only your local branches and not remote ones? Or is it possible that I am using git-sweep incorrectly and that functionality is already there?

This would be super useful because I tend to forget to delete my local branches after merging them with master and end up with a huge list of branches that I need to check one at a time to see if it is safe to delete.

Thanks!

robmadole commented 12 years ago

Great idea. I think I have this problem too. It's certainly possible.

Out of curiosity, is there a reason why you would not remove the remote branches too?

marc2982 commented 12 years ago

Good question...at work we do have some old remote branches that are hanging around for historical purposes...although the same could be (and probably should be) handled using tags. I can't think of any compelling reason, except possibly for speed. Would it be faster to check a local branch or would it take the same amount of time as a remote branch?

robmadole commented 12 years ago

The check to see if it's merged takes exactly the same amount of time. So preview would be just as instantaneous.

This would be a great feature. Let me see about getting this into a milestone. Thanks for the feedback.

marc2982 commented 12 years ago

Cool thanks :)

dancrew32 commented 12 years ago

+1

robmadole commented 12 years ago

Slating this for 0.1.2

robmadole commented 12 years ago

In the short term until this is implemented, the following command works:

git branch --merged master | grep -v master | xargs git branch -d

Nasty hack for the time being. I'm hoping to get some time to work on this project soon, it's overdue for a next release.

marc2982 commented 12 years ago

Awesome thanks! I hadn't noticed 'git branch --merged' before.

suan commented 12 years ago

+1

cupakromer commented 11 years ago

:+1:

Another use case for this feature is for use of branches during local dev. These local branches were used solely for development (quick one off fixes, spikes, etc), and they were merged into the local master. The local master was then pushed to the remote but not the other local branches.

dsbonev commented 10 years ago

+1

jtsao22 commented 10 years ago

+1

davidofwatkins commented 9 years ago

+1

jeuelc commented 9 years ago

+1

sushruthajirnis commented 8 years ago

+1