From 4efcd6cff6ca22bca40e4ab170ffe51f2ea15e7f Mon Sep 17 00:00:00 2001 From: "Schumacher, Jeffrey" Date: Mon, 13 Jun 2016 11:17:54 -0700 Subject: [PATCH] Adding alternative to deleting branches merged to master that will not delete master itself --- README.md | 6 ++++++ tips.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39bc453..fee81cd 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,12 @@ git checkout - git branch --merged master | grep -v '^\*' | xargs -n 1 git branch -d ``` + +__Alternatives:__ +```sh +git branch --merged master | grep -v '^\*\| master' | xargs -n 1 git branch -d # will not delete master if master is not checked out +``` + ## List all branches and their upstreams, as well as last commit on branch ```sh git branch -vv diff --git a/tips.json b/tips.json index a073925..89473bd 100644 --- a/tips.json +++ b/tips.json @@ -37,7 +37,8 @@ "tip": "git checkout -" }, { "title": "Remove branches that have already been merged with master", - "tip": "git branch --merged master | grep -v '^\\*' | xargs -n 1 git branch -d" + "tip": "git branch --merged master | grep -v '^\\*' | xargs -n 1 git branch -d", + "alternatives": ["git branch --merged master | grep -v '^\\*\\| master' | xargs -n 1 git branch -d # will not delete master if master is not checked out"] }, { "title": "List all branches and their upstreams, as well as last commit on branch", "tip": "git branch -vv"