mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
add: git-ignore -p (private to repo)
This commit is contained in:
parent
a4f85ae6ff
commit
0f76863d9b
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 "$@"
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
<pattern>
|
||||
.
|
||||
.P
|
||||
|
|
|
|||
|
|
@ -94,6 +94,10 @@
|
|||
|
||||
<p> Sets the context to the global gitignore file for the current user.</p>
|
||||
|
||||
<p> -p, --private</p>
|
||||
|
||||
<p> Sets the context to the private exclude file for the repository (<code>.git/info/exclude</code>).</p>
|
||||
|
||||
<p> <pattern></p>
|
||||
|
||||
<p> A space delimited list of patterns to append to the file in context.</p>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue