3 # bash completion support for core Git.
5 # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
6 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
7 # Distributed under the GNU General Public License, version 2.0.
9 # The contained completion routines provide support for completing:
11 # *) local and remote branch names
12 # *) local and remote tag names
13 # *) .git/remotes file names
14 # *) git 'subcommands'
15 # *) tree paths within 'ref:path/to/file' expressions
16 # *) common --long-options
18 # To use these routines:
20 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
21 # 2) Added the following line to your .bashrc:
22 # source ~/.git-completion.sh
24 # 3) You may want to make sure the git executable is available
25 # in your PATH before this script is sourced, as some caching
26 # is performed while the script loads. If git isn't found
27 # at source time then all lookups will be done on demand,
28 # which may be slightly slower.
30 # 4) Consider changing your PS1 to also show the current branch:
31 # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
33 # The argument to __git_ps1 will be displayed only if you
34 # are currently in a git repository. The %s token will be
35 # the name of the current branch.
37 # In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
38 # value, unstaged (*) and staged (+) changes will be shown next
39 # to the branch name. You can configure this per-repository
40 # with the bash.showDirtyState variable, which defaults to true
41 # once GIT_PS1_SHOWDIRTYSTATE is enabled.
45 # *) Read Documentation/SubmittingPatches
46 # *) Send all patches to the current maintainer:
48 # "Shawn O. Pearce" <spearce@spearce.org>
50 # *) Always CC the Git mailing list:
55 case "$COMP_WORDBREAKS" in
57 *) COMP_WORDBREAKS
="$COMP_WORDBREAKS:"
60 # __gitdir accepts 0 or 1 arguments (i.e., location)
61 # returns location of .git repo
64 if [ -z "${1-}" ]; then
65 if [ -n "$__git_dir" ]; then
67 elif [ -d .git
]; then
70 git rev-parse
--git-dir 2>/dev
/null
72 elif [ -d "$1/.git" ]; then
79 # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
80 # returns text to add to bash PS1 prompt (includes branch name)
83 local g
="$(git rev-parse --git-dir 2>/dev/null)"
87 if [ -d "$g/rebase-apply" ]
89 if test -f "$g/rebase-apply/rebasing"
92 elif test -f "$g/rebase-apply/applying"
98 b
="$(git symbolic-ref HEAD 2>/dev/null)"
99 elif [ -f "$g/rebase-merge/interactive" ]
102 b
="$(cat "$g/rebase-merge
/head-name
")"
103 elif [ -d "$g/rebase-merge" ]
106 b
="$(cat "$g/rebase-merge
/head-name
")"
107 elif [ -f "$g/MERGE_HEAD" ]
110 b
="$(git symbolic-ref HEAD 2>/dev/null)"
112 if [ -f "$g/BISECT_LOG" ]
116 if ! b
="$(git symbolic-ref HEAD 2>/dev/null)"
118 if ! b
="$(git describe --exact-match HEAD 2>/dev/null)"
120 b
="$(cut -c1-7 "$g/HEAD
")..."
128 if test -n "$GIT_PS1_SHOWDIRTYSTATE"; then
129 if test "$(git config --bool bash.showDirtyState)" != "false"; then
130 git
diff --no-ext-diff --ignore-submodules \
131 --quiet --exit-code || w
="*"
132 if git rev-parse
--quiet --verify HEAD
>/dev
/null
; then
133 git diff-index
--cached --quiet \
134 --ignore-submodules HEAD
-- || i
="+"
141 if [ -n "${1-}" ]; then
142 printf "$1" "${b##refs/heads/}$w$i$r"
144 printf " (%s)" "${b##refs/heads/}$w$i$r"
149 # __gitcomp_1 requires 2 arguments
152 local c IFS
=' '$
'\t'$
'\n'
155 --*=*) printf %s$
'\n' "$c$2" ;;
156 *.
) printf %s$
'\n' "$c$2" ;;
157 *) printf %s$
'\n' "$c$2 " ;;
162 # __gitcomp accepts 1, 2, 3, or 4 arguments
163 # generates completion reply with compgen
166 local cur
="${COMP_WORDS[COMP_CWORD]}"
167 if [ $# -gt 2 ]; then
176 COMPREPLY
=($
(compgen
-P "${2-}" \
177 -W "$(__gitcomp_1 "${1-}" "${4-}")" \
183 # __git_heads accepts 0 or 1 arguments (to pass to __gitdir)
186 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
187 if [ -d "$dir" ]; then
188 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
192 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
193 case "$is_hash,$i" in
196 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
197 n
,*) is_hash
=y
; echo "$i" ;;
202 # __git_tags accepts 0 or 1 arguments (to pass to __gitdir)
205 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
206 if [ -d "$dir" ]; then
207 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
211 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
212 case "$is_hash,$i" in
215 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
216 n
,*) is_hash
=y
; echo "$i" ;;
221 # __git_refs accepts 0 or 1 arguments (to pass to __gitdir)
224 local i is_hash
=y dir
="$(__gitdir "${1-}")"
225 local cur
="${COMP_WORDS[COMP_CWORD]}" format refs
226 if [ -d "$dir" ]; then
233 if [ -e "$dir/HEAD" ]; then echo HEAD
; fi
234 format
="refname:short"
235 refs
="refs/tags refs/heads refs/remotes"
238 git
--git-dir="$dir" for-each-ref
--format="%($format)" \
242 for i
in $
(git ls-remote
"$dir" 2>/dev
/null
); do
243 case "$is_hash,$i" in
246 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
247 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
248 n
,refs
/remotes
/*) is_hash
=y
; echo "${i#refs/remotes/}" ;;
249 n
,*) is_hash
=y
; echo "$i" ;;
254 # __git_refs2 requires 1 argument (to pass to __git_refs)
258 for i
in $
(__git_refs
"$1"); do
263 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
264 __git_refs_remotes
()
266 local cmd i is_hash
=y
267 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
268 case "$is_hash,$i" in
271 echo "$i:refs/remotes/$1/${i#refs/heads/}"
275 n
,refs
/tags
/*) is_hash
=y
;;
283 local i ngoff IFS
=$
'\n' d
="$(__gitdir)"
284 shopt -q nullglob || ngoff
=1
286 for i
in "$d/remotes"/*; do
287 echo ${i#$d/remotes/}
289 [ "$ngoff" ] && shopt -u nullglob
290 for i
in $
(git
--git-dir="$d" config
--list); do
300 __git_merge_strategies
()
302 if [ -n "$__git_merge_strategylist" ]; then
303 echo "$__git_merge_strategylist"
306 git merge
-s help 2>&1 |
307 sed -n -e '/[Aa]vailable strategies are: /,/^$/{
315 __git_merge_strategylist
=
316 __git_merge_strategylist
=$
(__git_merge_strategies
2>/dev
/null
)
318 __git_complete_file
()
320 local pfx
ls ref cur
="${COMP_WORDS[COMP_CWORD]}"
337 case "$COMP_WORDBREAKS" in
339 *) pfx
="$ref:$pfx" ;;
343 COMPREPLY
=($
(compgen
-P "$pfx" \
344 -W "$(git --git-dir="$
(__gitdir
)" ls-tree "$ls" \
345 | sed '/^100... blob /{
361 __gitcomp
"$(__git_refs)"
366 __git_complete_revlist
()
368 local pfx cur
="${COMP_WORDS[COMP_CWORD]}"
373 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
378 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
381 __gitcomp
"$(__git_refs)"
386 __git_all_commands
()
388 if [ -n "$__git_all_commandlist" ]; then
389 echo "$__git_all_commandlist"
393 for i
in $
(git
help -a|
egrep '^ ')
396 *--*) : helper pattern
;;
401 __git_all_commandlist
=
402 __git_all_commandlist
="$(__git_all_commands 2>/dev/null)"
404 __git_porcelain_commands
()
406 if [ -n "$__git_porcelain_commandlist" ]; then
407 echo "$__git_porcelain_commandlist"
411 for i
in "help" $
(__git_all_commands
)
414 *--*) : helper pattern
;;
415 applymbox
) : ask gittus
;;
416 applypatch
) : ask gittus
;;
417 archimport
) : import
;;
418 cat-file
) : plumbing
;;
419 check-attr
) : plumbing
;;
420 check-ref-format
) : plumbing
;;
421 checkout-index
) : plumbing
;;
422 commit-tree
) : plumbing
;;
423 count-objects
) : infrequent
;;
424 cvsexportcommit
) : export;;
425 cvsimport
) : import
;;
426 cvsserver
) : daemon
;;
428 diff-files
) : plumbing
;;
429 diff-index
) : plumbing
;;
430 diff-tree
) : plumbing
;;
431 fast-import
) : import
;;
432 fast-export
) : export;;
433 fsck-objects
) : plumbing
;;
434 fetch-pack
) : plumbing
;;
435 fmt-merge-msg
) : plumbing
;;
436 for-each-ref
) : plumbing
;;
437 hash-object
) : plumbing
;;
438 http-
*) : transport
;;
439 index-pack
) : plumbing
;;
440 init-db
) : deprecated
;;
441 local-fetch
) : plumbing
;;
442 lost-found
) : infrequent
;;
443 ls-files
) : plumbing
;;
444 ls-remote
) : plumbing
;;
445 ls-tree
) : plumbing
;;
446 mailinfo
) : plumbing
;;
447 mailsplit
) : plumbing
;;
448 merge-
*) : plumbing
;;
451 pack-objects
) : plumbing
;;
452 pack-redundant
) : plumbing
;;
453 pack-refs
) : plumbing
;;
454 parse-remote
) : plumbing
;;
455 patch-id
) : plumbing
;;
456 peek-remote
) : plumbing
;;
458 prune-packed
) : plumbing
;;
459 quiltimport
) : import
;;
460 read-tree
) : plumbing
;;
461 receive-pack
) : plumbing
;;
463 repo-config
) : deprecated
;;
465 rev-list
) : plumbing
;;
466 rev-parse
) : plumbing
;;
467 runstatus
) : plumbing
;;
468 sh-setup
) : internal
;;
470 show-ref
) : plumbing
;;
471 send-pack
) : plumbing
;;
472 show-index
) : plumbing
;;
474 stripspace
) : plumbing
;;
475 symbolic-ref
) : plumbing
;;
476 tar-tree
) : deprecated
;;
477 unpack-file
) : plumbing
;;
478 unpack-objects
) : plumbing
;;
479 update-index
) : plumbing
;;
480 update-ref
) : plumbing
;;
481 update-server-info
) : daemon
;;
482 upload-archive
) : plumbing
;;
483 upload-pack
) : plumbing
;;
484 write-tree
) : plumbing
;;
486 verify-pack
) : infrequent
;;
487 verify-tag
) : plumbing
;;
492 __git_porcelain_commandlist
=
493 __git_porcelain_commandlist
="$(__git_porcelain_commands 2>/dev/null)"
498 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
508 # __git_aliased_command requires 1 argument
509 __git_aliased_command
()
511 local word cmdline
=$
(git
--git-dir="$(__gitdir)" \
512 config
--get "alias.$1")
513 for word
in $cmdline; do
514 if [ "${word##-*}" ]; then
521 # __git_find_subcommand requires 1 argument
522 __git_find_subcommand
()
524 local word subcommand c
=1
526 while [ $c -lt $COMP_CWORD ]; do
527 word
="${COMP_WORDS[c]}"
528 for subcommand
in $1; do
529 if [ "$subcommand" = "$word" ]; then
538 __git_has_doubledash
()
541 while [ $c -lt $COMP_CWORD ]; do
542 if [ "--" = "${COMP_WORDS[c]}" ]; then
550 __git_whitespacelist
="nowarn warn error error-all fix"
554 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
555 if [ -d "$dir"/rebase-apply
]; then
556 __gitcomp
"--skip --resolved --abort"
561 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
566 --signoff --utf8 --binary --3way --interactive
576 local cur
="${COMP_WORDS[COMP_CWORD]}"
579 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
584 --stat --numstat --summary --check --index
585 --cached --index-info --reverse --reject --unidiff-zero
586 --apply --no-add --exclude=
587 --whitespace= --inaccurate-eof --verbose
596 __git_has_doubledash
&& return
598 local cur
="${COMP_WORDS[COMP_CWORD]}"
602 --interactive --refresh --patch --update --dry-run
603 --ignore-errors --intent-to-add
612 local cur
="${COMP_WORDS[COMP_CWORD]}"
615 __gitcomp
"$(git archive --list)" "" "${cur##--format=}"
619 __gitcomp
"$(__git_remotes)" "" "${cur##--remote=}"
624 --format= --list --verbose
625 --prefix= --remote= --exec=
635 __git_has_doubledash
&& return
637 local subcommands
="start bad good skip reset visualize replay log run"
638 local subcommand
="$(__git_find_subcommand "$subcommands")"
639 if [ -z "$subcommand" ]; then
640 __gitcomp
"$subcommands"
644 case "$subcommand" in
646 __gitcomp
"$(__git_refs)"
656 local i c
=1 only_local_ref
="n" has_r
="n"
658 while [ $c -lt $COMP_CWORD ]; do
661 -d|
-m) only_local_ref
="y" ;;
667 case "${COMP_WORDS[COMP_CWORD]}" in
670 --color --no-color --verbose --abbrev= --no-abbrev
671 --track --no-track --contains --merged --no-merged
675 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
676 __gitcomp
"$(__git_heads)"
678 __gitcomp
"$(__git_refs)"
686 local cmd
="${COMP_WORDS[2]}"
687 case "$COMP_CWORD" in
689 __gitcomp
"create list-heads verify unbundle"
697 __git_complete_revlist
706 __git_has_doubledash
&& return
708 __gitcomp
"$(__git_refs)"
713 __gitcomp
"$(__git_refs)"
718 local cur
="${COMP_WORDS[COMP_CWORD]}"
721 __gitcomp
"--edit --no-commit"
724 __gitcomp
"$(__git_refs)"
731 __git_has_doubledash
&& return
733 local cur
="${COMP_WORDS[COMP_CWORD]}"
736 __gitcomp
"--dry-run --quiet"
745 local cur
="${COMP_WORDS[COMP_CWORD]}"
770 __git_has_doubledash
&& return
772 local cur
="${COMP_WORDS[COMP_CWORD]}"
776 --all --author= --signoff --verify --no-verify
777 --edit --amend --include --only --interactive
786 local cur
="${COMP_WORDS[COMP_CWORD]}"
790 --all --tags --contains --abbrev= --candidates=
791 --exact-match --debug --long --match --always
795 __gitcomp
"$(__git_refs)"
798 __git_diff_common_options
="--stat --numstat --shortstat --summary
799 --patch-with-stat --name-only --name-status --color
800 --no-color --color-words --no-renames --check
801 --full-index --binary --abbrev --diff-filter=
803 --text --ignore-space-at-eol --ignore-space-change
804 --ignore-all-space --exit-code --quiet --ext-diff
806 --no-prefix --src-prefix= --dst-prefix=
807 --inter-hunk-context=
814 __git_has_doubledash
&& return
816 local cur
="${COMP_WORDS[COMP_CWORD]}"
819 __gitcomp
"--cached --pickaxe-all --pickaxe-regex
820 --base --ours --theirs
821 $__git_diff_common_options
831 local cur
="${COMP_WORDS[COMP_CWORD]}"
833 if [ "$COMP_CWORD" = 2 ]; then
834 __gitcomp
"$(__git_remotes)"
839 case "$COMP_WORDBREAKS" in
841 *) pfx
="${cur%%:*}:" ;;
843 __gitcomp
"$(__git_refs)" "$pfx" "${cur#*:}"
846 __gitcomp
"$(__git_refs2 "${COMP_WORDS[2]}")"
854 local cur
="${COMP_WORDS[COMP_CWORD]}"
858 --stdout --attach --thread
860 --numbered --start-number
865 --full-index --binary
868 --no-prefix --src-prefix= --dst-prefix=
869 --inline --suffix= --ignore-if-in-upstream
875 __git_complete_revlist
880 local cur
="${COMP_WORDS[COMP_CWORD]}"
883 __gitcomp
"--prune --aggressive"
892 __git_has_doubledash
&& return
894 local cur
="${COMP_WORDS[COMP_CWORD]}"
899 --text --ignore-case --word-regexp --invert-match
901 --extended-regexp --basic-regexp --fixed-strings
902 --files-with-matches --name-only
903 --files-without-match
905 --and --or --not --all-match
915 local cur
="${COMP_WORDS[COMP_CWORD]}"
918 __gitcomp
"--all --info --man --web"
922 __gitcomp
"$(__git_all_commands)
923 attributes cli core-tutorial cvs-migration
924 diffcore gitk glossary hooks ignore modules
925 repository-layout tutorial tutorial-2
932 local cur
="${COMP_WORDS[COMP_CWORD]}"
936 false true umask group all world everybody
937 " "" "${cur##--shared=}"
941 __gitcomp
"--quiet --bare --template= --shared --shared="
950 __git_has_doubledash
&& return
952 local cur
="${COMP_WORDS[COMP_CWORD]}"
955 __gitcomp
"--cached --deleted --modified --others --ignored
956 --stage --directory --no-empty-directory --unmerged
957 --killed --exclude= --exclude-from=
958 --exclude-per-directory= --exclude-standard
959 --error-unmatch --with-tree= --full-name
960 --abbrev --ignored --exclude-per-directory
970 __gitcomp
"$(__git_remotes)"
978 __git_log_pretty_formats
="oneline short medium full fuller email raw format:"
982 __git_has_doubledash
&& return
984 local cur
="${COMP_WORDS[COMP_CWORD]}"
987 __gitcomp
"$__git_log_pretty_formats
988 " "" "${cur##--pretty=}"
993 relative iso8601 rfc2822 short local default
994 " "" "${cur##--date=}"
999 --max-count= --max-age= --since= --after=
1000 --min-age= --before= --until=
1001 --root --topo-order --date-order --reverse
1002 --no-merges --follow
1003 --abbrev-commit --abbrev=
1004 --relative-date --date=
1005 --author= --committer= --grep=
1009 --left-right --cherry-pick
1013 --parents --children --full-history
1015 $__git_diff_common_options
1016 --pickaxe-all --pickaxe-regex
1021 __git_complete_revlist
1026 local cur
="${COMP_WORDS[COMP_CWORD]}"
1027 case "${COMP_WORDS[COMP_CWORD-1]}" in
1029 __gitcomp
"$(__git_merge_strategies)"
1034 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
1039 --no-commit --no-stat --log --no-log --squash --strategy
1043 __gitcomp
"$(__git_refs)"
1048 local cur
="${COMP_WORDS[COMP_CWORD]}"
1052 kdiff3 tkdiff meld xxdiff emerge
1053 vimdiff gvimdiff ecmerge opendiff
1054 " "" "${cur##--tool=}"
1067 __gitcomp
"$(__git_refs)"
1072 local cur
="${COMP_WORDS[COMP_CWORD]}"
1075 __gitcomp
"--dry-run"
1084 __gitcomp
"--tags --all --stdin"
1089 local cur
="${COMP_WORDS[COMP_CWORD]}"
1091 if [ "$COMP_CWORD" = 2 ]; then
1092 __gitcomp
"$(__git_remotes)"
1094 __gitcomp
"$(__git_refs "${COMP_WORDS[2]}")"
1100 local cur
="${COMP_WORDS[COMP_CWORD]}"
1102 if [ "$COMP_CWORD" = 2 ]; then
1103 __gitcomp
"$(__git_remotes)"
1108 case "$COMP_WORDBREAKS" in
1110 *) pfx
="${cur%%:*}:" ;;
1113 __gitcomp
"$(__git_refs "${COMP_WORDS[2]}")" "$pfx" "${cur#*:}"
1116 __gitcomp
"$(__git_refs)" + "${cur#+}"
1119 __gitcomp
"$(__git_refs)"
1127 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
1128 if [ -d "$dir"/rebase-apply
] ||
[ -d "$dir"/rebase-merge
]; then
1129 __gitcomp
"--continue --skip --abort"
1132 case "${COMP_WORDS[COMP_CWORD-1]}" in
1134 __gitcomp
"$(__git_merge_strategies)"
1139 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
1143 __gitcomp
"--onto --merge --strategy --interactive"
1146 __gitcomp
"$(__git_refs)"
1151 local cur
="${COMP_WORDS[COMP_CWORD]}"
1154 __gitcomp
"--bcc --cc --cc-cmd --chain-reply-to --compose
1155 --dry-run --envelope-sender --from --identity
1156 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
1157 --no-suppress-from --no-thread --quiet
1158 --signed-off-by-cc --smtp-pass --smtp-server
1159 --smtp-server-port --smtp-ssl --smtp-user --subject
1160 --suppress-cc --suppress-from --thread --to
1161 --validate --no-validate"
1170 local cur
="${COMP_WORDS[COMP_CWORD]}"
1171 local prv
="${COMP_WORDS[COMP_CWORD-1]}"
1174 __gitcomp
"$(__git_remotes)"
1178 __gitcomp
"$(__git_refs)"
1182 local remote
="${prv#remote.}"
1183 remote
="${remote%.fetch}"
1184 __gitcomp
"$(__git_refs_remotes "$remote")"
1188 local remote
="${prv#remote.}"
1189 remote
="${remote%.push}"
1190 __gitcomp
"$(git --git-dir="$
(__gitdir
)" \
1191 for-each-ref --format='%(refname):%(refname)' \
1195 pull.twohead|pull.octopus
)
1196 __gitcomp
"$(__git_merge_strategies)"
1199 color.branch|color.
diff|color.status
)
1200 __gitcomp
"always never auto"
1205 normal black red green yellow blue magenta cyan white
1206 bold dim ul blink reverse
1218 --global --system --file=
1219 --list --replace-all
1220 --get --get-all --get-regexp
1221 --add --unset --unset-all
1222 --remove-section --rename-section
1227 local pfx
="${cur%.*}."
1229 __gitcomp
"remote merge mergeoptions" "$pfx" "$cur"
1233 local pfx
="${cur%.*}."
1235 __gitcomp
"$(__git_heads)" "$pfx" "$cur" "."
1239 local pfx
="${cur%.*}."
1242 url proxy fetch push mirror skipDefaultUpdate
1243 receivepack uploadpack tagopt
1248 local pfx
="${cur%.*}."
1250 __gitcomp
"$(__git_remotes)" "$pfx" "$cur" "."
1256 branch.autosetupmerge
1257 branch.autosetuprebase
1260 color.branch.current
1271 color.diff.whitespace
1273 color.interactive.header
1274 color.interactive.help
1275 color.interactive.prompt
1279 color.status.changed
1281 color.status.nobranch
1282 color.status.untracked
1283 color.status.updated
1289 core.deltaBaseCacheLimit
1293 core.fsyncobjectfiles
1295 core.ignoreCygwinFSTricks
1297 core.logAllRefUpdates
1298 core.loosecompression
1300 core.packedGitWindowSize
1302 core.preferSymlinkRefs
1305 core.repositoryFormatVersion
1307 core.sharedRepository
1310 core.warnAmbiguousRefs
1313 diff.autorefreshindex
1330 gc.reflogexpireunreachable
1334 gitcvs.dbTableNamePrefix
1344 gui.copyblamethreshold
1348 gui.matchtrackingbranch
1349 gui.newbranchtemplate
1350 gui.pruneduringfetch
1351 gui.spellingdictionary
1367 i18n.logOutputEncoding
1382 mergetool.keepBackup
1384 pack.deltaCacheLimit
1394 receive.denyCurrentBranch
1396 receive.denyNonFastForwards
1399 repack.usedeltabaseoffset
1403 status.relativePaths
1404 status.showUntrackedFiles
1406 transfer.unpackLimit
1417 local subcommands
="add rename rm show prune update"
1418 local subcommand
="$(__git_find_subcommand "$subcommands")"
1419 if [ -z "$subcommand" ]; then
1420 __gitcomp
"$subcommands"
1424 case "$subcommand" in
1425 rename|
rm|show|prune
)
1426 __gitcomp
"$(__git_remotes)"
1429 local i c
='' IFS
=$
'\n'
1430 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
1448 __git_has_doubledash
&& return
1450 local cur
="${COMP_WORDS[COMP_CWORD]}"
1453 __gitcomp
"--merge --mixed --hard --soft"
1457 __gitcomp
"$(__git_refs)"
1462 local cur
="${COMP_WORDS[COMP_CWORD]}"
1465 __gitcomp
"--edit --mainline --no-edit --no-commit --signoff"
1469 __gitcomp
"$(__git_refs)"
1474 __git_has_doubledash
&& return
1476 local cur
="${COMP_WORDS[COMP_CWORD]}"
1479 __gitcomp
"--cached --dry-run --ignore-unmatch --quiet"
1488 __git_has_doubledash
&& return
1490 local cur
="${COMP_WORDS[COMP_CWORD]}"
1494 --max-count= --max-age= --since= --after=
1495 --min-age= --before= --until=
1497 --author= --committer= --grep=
1500 --numbered --summary
1505 __git_complete_revlist
1510 __git_has_doubledash
&& return
1512 local cur
="${COMP_WORDS[COMP_CWORD]}"
1515 __gitcomp
"$__git_log_pretty_formats
1516 " "" "${cur##--pretty=}"
1520 __gitcomp
"--pretty=
1521 $__git_diff_common_options
1531 local cur
="${COMP_WORDS[COMP_CWORD]}"
1535 --all --remotes --topo-order --current --more=
1536 --list --independent --merge-base --no-name
1537 --sha1-name --topics --reflog
1542 __git_complete_revlist
1547 local subcommands
='save list show apply clear drop pop create branch'
1548 local subcommand
="$(__git_find_subcommand "$subcommands")"
1549 if [ -z "$subcommand" ]; then
1550 __gitcomp
"$subcommands"
1552 local cur
="${COMP_WORDS[COMP_CWORD]}"
1553 case "$subcommand,$cur" in
1555 __gitcomp
"--keep-index"
1560 show
,--*|drop
,--*|pop
,--*|branch
,--*)
1563 show
,*|apply
,*|drop
,*|pop
,*|branch
,*)
1564 __gitcomp
"$(git --git-dir="$
(__gitdir
)" stash list \
1565 | sed -n -e 's/:.*//p')"
1576 __git_has_doubledash
&& return
1578 local subcommands
="add status init update summary foreach sync"
1579 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1580 local cur
="${COMP_WORDS[COMP_CWORD]}"
1583 __gitcomp
"--quiet --cached"
1586 __gitcomp
"$subcommands"
1596 init fetch clone rebase dcommit log find-rev
1597 set-tree commit-diff info create-ignore propget
1598 proplist show-ignore show-externals
1600 local subcommand
="$(__git_find_subcommand "$subcommands")"
1601 if [ -z "$subcommand" ]; then
1602 __gitcomp
"$subcommands"
1604 local remote_opts
="--username= --config-dir= --no-auth-cache"
1606 --follow-parent --authors-file= --repack=
1607 --no-metadata --use-svm-props --use-svnsync-props
1608 --log-window-size= --no-checkout --quiet
1609 --repack-flags --user-log-author --localtime $remote_opts
1612 --template= --shared= --trunk= --tags=
1613 --branches= --stdlayout --minimize-url
1614 --no-metadata --use-svm-props --use-svnsync-props
1615 --rewrite-root= $remote_opts
1618 --edit --rmdir --find-copies-harder --copy-similarity=
1621 local cur
="${COMP_WORDS[COMP_CWORD]}"
1622 case "$subcommand,$cur" in
1624 __gitcomp
"--revision= --fetch-all $fc_opts"
1627 __gitcomp
"--revision= $fc_opts $init_opts"
1630 __gitcomp
"$init_opts"
1634 --merge --strategy= --verbose --dry-run
1635 --fetch-all --no-rebase $cmt_opts $fc_opts
1639 __gitcomp
"--stdin $cmt_opts $fc_opts"
1641 create-ignore
,--*|propget
,--*|proplist
,--*|show-ignore
,--*|\
1643 __gitcomp
"--revision="
1647 --limit= --revision= --verbose --incremental
1648 --oneline --show-commit --non-recursive
1654 --merge --verbose --strategy= --local
1655 --fetch-all $fc_opts
1659 __gitcomp
"--message= --file= --revision= $cmt_opts"
1674 while [ $c -lt $COMP_CWORD ]; do
1675 i
="${COMP_WORDS[c]}"
1678 __gitcomp
"$(__git_tags)"
1688 case "${COMP_WORDS[COMP_CWORD-1]}" in
1694 __gitcomp
"$(__git_tags)"
1700 __gitcomp
"$(__git_refs)"
1707 local i c
=1 command __git_dir
1709 while [ $c -lt $COMP_CWORD ]; do
1710 i
="${COMP_WORDS[c]}"
1712 --git-dir=*) __git_dir
="${i#--git-dir=}" ;;
1713 --bare) __git_dir
="." ;;
1714 --version|
-p|
--paginate) ;;
1715 --help) command="help"; break ;;
1716 *) command="$i"; break ;;
1721 if [ -z "$command" ]; then
1722 case "${COMP_WORDS[COMP_CWORD]}" in
1734 *) __gitcomp
"$(__git_porcelain_commands) $(__git_aliases)" ;;
1739 local expansion
=$
(__git_aliased_command
"$command")
1740 [ "$expansion" ] && command="$expansion"
1745 apply
) _git_apply
;;
1746 archive
) _git_archive
;;
1747 bisect
) _git_bisect
;;
1748 bundle
) _git_bundle
;;
1749 branch
) _git_branch
;;
1750 checkout
) _git_checkout
;;
1751 cherry
) _git_cherry
;;
1752 cherry-pick
) _git_cherry_pick
;;
1753 clean
) _git_clean
;;
1754 clone
) _git_clone
;;
1755 commit
) _git_commit
;;
1756 config
) _git_config
;;
1757 describe
) _git_describe
;;
1759 fetch
) _git_fetch
;;
1760 format-patch
) _git_format_patch
;;
1766 ls-files
) _git_ls_files
;;
1767 ls-remote
) _git_ls_remote
;;
1768 ls-tree
) _git_ls_tree
;;
1770 mergetool
) _git_mergetool
;;
1771 merge-base
) _git_merge_base
;;
1773 name-rev
) _git_name_rev
;;
1776 rebase
) _git_rebase
;;
1777 remote
) _git_remote
;;
1778 reset) _git_reset
;;
1779 revert
) _git_revert
;;
1781 send-email
) _git_send_email
;;
1782 shortlog
) _git_shortlog
;;
1784 show-branch
) _git_show_branch
;;
1785 stash
) _git_stash
;;
1787 submodule
) _git_submodule
;;
1790 whatchanged
) _git_log
;;
1797 __git_has_doubledash
&& return
1799 local cur
="${COMP_WORDS[COMP_CWORD]}"
1800 local g
="$(git rev-parse --git-dir 2>/dev/null)"
1802 if [ -f $g/MERGE_HEAD
]; then
1807 __gitcomp
"--not --all $merge"
1811 __git_complete_revlist
1814 complete
-o bashdefault
-o default
-o nospace
-F _git git
2>/dev
/null \
1815 || complete
-o default
-o nospace
-F _git git
1816 complete
-o bashdefault
-o default
-o nospace
-F _gitk gitk
2>/dev
/null \
1817 || complete
-o default
-o nospace
-F _gitk gitk
1819 # The following are necessary only for Cygwin, and only are needed
1820 # when the user has tab-completed the executable name and consequently
1821 # included the '.exe' suffix.
1823 if [ Cygwin
= "$(uname -o 2>/dev/null)" ]; then
1824 complete
-o bashdefault
-o default
-o nospace
-F _git git.exe
2>/dev
/null \
1825 || complete
-o default
-o nospace
-F _git git.exe