From 03740447901aee0716b88927312501a34182701c Mon Sep 17 00:00:00 2001 From: spacewander Date: Mon, 17 Nov 2014 21:36:56 +0800 Subject: [PATCH] modify the behavior of git-ignore, now it will cd root to find .gitignore --- bin/git-ignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/git-ignore b/bin/git-ignore index a563afe..434e857 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -1,7 +1,11 @@ #!/usr/bin/env bash function show_contents { - test -f "$2" && echo "$1 gitignore: $2" && cat "$2" + if [ -f "$2" ]; then + echo "$1 gitignore: $2" && cat "$2" + else + echo "There is not $1 .gitignore yet" + fi } function show_global { @@ -13,10 +17,12 @@ function add_global { } function show_local { + cd "$(git root)" show_contents Local .gitignore } function add_local { + cd "$(git root)" add_patterns .gitignore "$@" }