From 01f8f515e27ebe9430ba598904c6a9c16290e8ec Mon Sep 17 00:00:00 2001 From: hophacker Date: Sun, 14 Jul 2019 20:31:59 +0800 Subject: [PATCH] show changes of files in gitcopy, avoid error info shown --- zsh/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 7450c0c..5375a6f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -153,8 +153,8 @@ function gitcopy() { done prefix=`git remote get-url origin | sed -E 's/git@github.com:/https:\/\/github.com\//g' | sed -E 's/(.*)\.git/\1/'` project_name=`echo $prefix | sed -E 's/.*\/(.*)/\1/'` - commits=`git log $commit --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**" | head -n $n` - which pbcopy + commits=`git log $commit -n $n --stat --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**"` + which pbcopy &> /dev/null if [[ $? == '0' ]]; then echo $commits | pbcopy fi