5 ms·
> $ git branch --merged | xargs git branch -d does this actually work? `git branch --merged` for me also returns '* master', which when xarg'd would inclu
by kbar13 13y ago
> $ git branch --merged | xargs git branch -d
does this actually work? `git branch --merged` for me also
returns '* master', which when xarg'd would include the '*'
and also 'master'. I don't want to delete master, and I
certainly dont want to delete * if it globs.
EDIT: made this into a code block as I have no idea how to make asterisks display.
- mef 13y agoIt'll be fine, git will refuse to delete the branch you're on and the loop will continue: error: Cannot delete the branch 'master' which you are currently on.
- ochronus 13y agoYeah, didn't think about that, could be tricky if you're on another branch. Nice catch!
- deleted 13y ago[deleted]
- icecreammatt 13y agoI have an alias that I have created that prevents the branch you are currently on or master from being deleted. alias gclean='git remote prune origin; git branch --merged | grep -v -E "(\*|master)" | xargs -n 1 git branch -d'
- click170 13y agoI'm not sure, but I can tell you how I'd find out. I'd clone the repo to a different directory and try it out in that test environment. Then delete the it when I'm done. #gitFTW