diff --git a/Commands.md b/Commands.md index c511de1..6bee468 100644 --- a/Commands.md +++ b/Commands.md @@ -602,6 +602,7 @@ To show just the global or just the local file's contents, you can use the follo * `-g` or `--global` to show just the global file * `-l` or `--local` to show just the local file +* `-p` or `--private` to show just the repository's file ```bash $ git ignore -g diff --git a/bin/git-ignore b/bin/git-ignore index 85bd5e4..11a59d4 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -35,6 +35,16 @@ function add_local { add_patterns .gitignore "$@" } +function show_private { + cd "$(git root)" + show_contents Private .git/info/exclude +} + +function add_private { + cd "$(git root)" + add_patterns .git/info/exclude "$@" +} + function add_patterns { echo "Adding pattern(s) to: $1" local file="${1/#~/$HOME}" @@ -48,6 +58,8 @@ if test $# -eq 0; then show_global echo "---------------------------------" show_local + echo "---------------------------------" + show_private else case "$1" in -l|--local) @@ -58,6 +70,10 @@ else test $# -gt 1 && add_global "${@:2}" && echo show_global ;; + -p|--private) + test $# -gt 1 && add_private "${@:2}" && echo + show_private + ;; *) add_local "$@" ;; diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index a28d3f3..d720ab4 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -94,11 +94,11 @@ _git_graft(){ _git_ignore(){ case "$cur" in --*) - __gitcomp "--global --local" + __gitcomp "--global --local --private" return ;; -*) - __gitcomp "--global --local -g -l" + __gitcomp "--global --local --private -g -l -p" return ;; esac diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 8272ff7..a5f5c0e 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -329,7 +329,8 @@ _git-guilt() { _git-ignore() { _arguments -C \ '(--local -l)'{--local,-l}'[show local gitignore]' \ - '(--global -g)'{--global,-g}'[show global gitignore]' + '(--global -g)'{--global,-g}'[show global gitignore]' \ + '(--private -p)'{--private,-p}'[show repo gitignore]' } diff --git a/man/git-ignore.1 b/man/git-ignore.1 index 63006d9..f1bf4ad 100644 --- a/man/git-ignore.1 +++ b/man/git-ignore.1 @@ -28,6 +28,12 @@ Sets the context to the \.gitignore file in the current working directory\. (def Sets the context to the global gitignore file for the current user\. . .P +\-p, \-\-private +. +.P +Sets the context to the private exclude file for the repository (\fB\.git/info/exclude\fR)\. +. +.P . .P diff --git a/man/git-ignore.html b/man/git-ignore.html index dec1139..951a23f 100644 --- a/man/git-ignore.html +++ b/man/git-ignore.html @@ -94,6 +94,10 @@

Sets the context to the global gitignore file for the current user.

+

-p, --private

+ +

Sets the context to the private exclude file for the repository (.git/info/exclude).

+

<pattern>

A space delimited list of patterns to append to the file in context.

diff --git a/man/git-ignore.md b/man/git-ignore.md index 968e822..e37f515 100644 --- a/man/git-ignore.md +++ b/man/git-ignore.md @@ -21,6 +21,10 @@ Adds the given _pattern_s to a .gitignore file if it doesn't already exist. Sets the context to the global gitignore file for the current user. + -p, --private + + Sets the context to the private exclude file for the repository (`.git/info/exclude`). + <pattern> A space delimited list of patterns to append to the file in context.