From 473107f679b61c1984ffbe08e513a0dff1f81172 Mon Sep 17 00:00:00 2001 From: Stuart Powers Date: Fri, 30 Dec 2016 02:17:21 -0500 Subject: [PATCH] Make xargs commands less dangerous --- README.md | 4 ++-- tips.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c52cb06..d98c18a 100644 --- a/README.md +++ b/README.md @@ -225,13 +225,13 @@ git checkout - ## Remove branches that have already been merged with master ```sh -git branch --merged master | grep -v '^\*' | xargs -n 1 git branch -d +git branch --merged master | grep -v '^\*' | xargs -d '\n' -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 +git branch --merged master | grep -v '^\*\| master' | xargs -d '\n' -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 diff --git a/tips.json b/tips.json index cc95b68..0905c99 100644 --- a/tips.json +++ b/tips.json @@ -37,8 +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", - "alternatives": ["git branch --merged master | grep -v '^\\*\\| master' | xargs -n 1 git branch -d # will not delete master if master is not checked out"] + "tip": "git branch --merged master | grep -v '^\\*' | xargs -d '\\n' -n 1 git branch -d", + "alternatives": ["git branch --merged master | grep -v '^\\*\\| master' | xargs -d '\\n' -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" @@ -440,4 +440,4 @@ }, { "title": "Preformatted patch file.", "tip": "git format-patch -M upstream..topic" -}] \ No newline at end of file +}]