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)
87 if [ -d "$g/rebase-apply" ]; then
88 if [ -f "$g/rebase-apply/rebasing" ]; then
90 elif [ -f "$g/rebase-apply/applying" ]; then
95 b
="$(git symbolic-ref HEAD 2>/dev/null)"
96 elif [ -f "$g/rebase-merge/interactive" ]; then
98 b
="$(cat "$g/rebase-merge
/head-name
")"
99 elif [ -d "$g/rebase-merge" ]; then
101 b
="$(cat "$g/rebase-merge
/head-name
")"
102 elif [ -f "$g/MERGE_HEAD" ]; then
104 b
="$(git symbolic-ref HEAD 2>/dev/null)"
106 if [ -f "$g/BISECT_LOG" ]; then
109 if ! b
="$(git symbolic-ref HEAD 2>/dev/null)"; then
110 if ! b
="$(git describe --exact-match HEAD 2>/dev/null)"; then
111 if [ -r "$g/HEAD" ]; then
112 b
="$(cut -c1-7 "$g/HEAD
")..."
122 if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
123 if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
128 elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
129 if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
130 if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
131 git
diff --no-ext-diff --ignore-submodules \
132 --quiet --exit-code || w
="*"
133 if git rev-parse
--quiet --verify HEAD
>/dev
/null
; then
134 git diff-index
--cached --quiet \
135 --ignore-submodules HEAD
-- || i
="+"
144 if [ -n "${1-}" ]; then
145 printf "$1" "$c${b##refs/heads/}$w$i$r"
147 printf " (%s)" "$c${b##refs/heads/}$w$i$r"
153 # __gitcomp_1 requires 2 arguments
156 local c IFS
=' '$
'\t'$
'\n'
159 --*=*) printf %s$
'\n' "$c$2" ;;
160 *.
) printf %s$
'\n' "$c$2" ;;
161 *) printf %s$
'\n' "$c$2 " ;;
166 # __gitcomp accepts 1, 2, 3, or 4 arguments
167 # generates completion reply with compgen
170 local cur
="${COMP_WORDS[COMP_CWORD]}"
171 if [ $# -gt 2 ]; then
180 COMPREPLY
=($
(compgen
-P "${2-}" \
181 -W "$(__gitcomp_1 "${1-}" "${4-}")" \
187 # __git_heads accepts 0 or 1 arguments (to pass to __gitdir)
190 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
191 if [ -d "$dir" ]; then
192 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
196 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
197 case "$is_hash,$i" in
200 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
201 n
,*) is_hash
=y
; echo "$i" ;;
206 # __git_tags accepts 0 or 1 arguments (to pass to __gitdir)
209 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
210 if [ -d "$dir" ]; then
211 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
215 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
216 case "$is_hash,$i" in
219 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
220 n
,*) is_hash
=y
; echo "$i" ;;
225 # __git_refs accepts 0 or 1 arguments (to pass to __gitdir)
228 local i is_hash
=y dir
="$(__gitdir "${1-}")"
229 local cur
="${COMP_WORDS[COMP_CWORD]}" format refs
230 if [ -d "$dir" ]; then
237 if [ -e "$dir/HEAD" ]; then echo HEAD
; fi
238 format
="refname:short"
239 refs
="refs/tags refs/heads refs/remotes"
242 git
--git-dir="$dir" for-each-ref
--format="%($format)" \
246 for i
in $
(git ls-remote
"$dir" 2>/dev
/null
); do
247 case "$is_hash,$i" in
250 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
251 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
252 n
,refs
/remotes
/*) is_hash
=y
; echo "${i#refs/remotes/}" ;;
253 n
,*) is_hash
=y
; echo "$i" ;;
258 # __git_refs2 requires 1 argument (to pass to __git_refs)
262 for i
in $
(__git_refs
"$1"); do
267 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
268 __git_refs_remotes
()
270 local cmd i is_hash
=y
271 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
272 case "$is_hash,$i" in
275 echo "$i:refs/remotes/$1/${i#refs/heads/}"
279 n
,refs
/tags
/*) is_hash
=y
;;
287 local i ngoff IFS
=$
'\n' d
="$(__gitdir)"
288 shopt -q nullglob || ngoff
=1
290 for i
in "$d/remotes"/*; do
291 echo ${i#$d/remotes/}
293 [ "$ngoff" ] && shopt -u nullglob
294 for i
in $
(git
--git-dir="$d" config
--list); do
304 __git_merge_strategies
()
306 if [ -n "${__git_merge_strategylist-}" ]; then
307 echo "$__git_merge_strategylist"
310 git merge
-s help 2>&1 |
311 sed -n -e '/[Aa]vailable strategies are: /,/^$/{
319 __git_merge_strategylist
=
320 __git_merge_strategylist
=$
(__git_merge_strategies
2>/dev
/null
)
322 __git_complete_file
()
324 local pfx
ls ref cur
="${COMP_WORDS[COMP_CWORD]}"
341 case "$COMP_WORDBREAKS" in
343 *) pfx
="$ref:$pfx" ;;
347 COMPREPLY
=($
(compgen
-P "$pfx" \
348 -W "$(git --git-dir="$
(__gitdir
)" ls-tree "$ls" \
349 | sed '/^100... blob /{
365 __gitcomp
"$(__git_refs)"
370 __git_complete_revlist
()
372 local pfx cur
="${COMP_WORDS[COMP_CWORD]}"
377 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
382 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
385 __gitcomp
"$(__git_refs)"
390 __git_all_commands
()
392 if [ -n "${__git_all_commandlist-}" ]; then
393 echo "$__git_all_commandlist"
397 for i
in $
(git
help -a|
egrep '^ ')
400 *--*) : helper pattern
;;
405 __git_all_commandlist
=
406 __git_all_commandlist
="$(__git_all_commands 2>/dev/null)"
408 __git_porcelain_commands
()
410 if [ -n "${__git_porcelain_commandlist-}" ]; then
411 echo "$__git_porcelain_commandlist"
415 for i
in "help" $
(__git_all_commands
)
418 *--*) : helper pattern
;;
419 applymbox
) : ask gittus
;;
420 applypatch
) : ask gittus
;;
421 archimport
) : import
;;
422 cat-file
) : plumbing
;;
423 check-attr
) : plumbing
;;
424 check-ref-format
) : plumbing
;;
425 checkout-index
) : plumbing
;;
426 commit-tree
) : plumbing
;;
427 count-objects
) : infrequent
;;
428 cvsexportcommit
) : export;;
429 cvsimport
) : import
;;
430 cvsserver
) : daemon
;;
432 diff-files
) : plumbing
;;
433 diff-index
) : plumbing
;;
434 diff-tree
) : plumbing
;;
435 fast-import
) : import
;;
436 fast-export
) : export;;
437 fsck-objects
) : plumbing
;;
438 fetch-pack
) : plumbing
;;
439 fmt-merge-msg
) : plumbing
;;
440 for-each-ref
) : plumbing
;;
441 hash-object
) : plumbing
;;
442 http-
*) : transport
;;
443 index-pack
) : plumbing
;;
444 init-db
) : deprecated
;;
445 local-fetch
) : plumbing
;;
446 lost-found
) : infrequent
;;
447 ls-files
) : plumbing
;;
448 ls-remote
) : plumbing
;;
449 ls-tree
) : plumbing
;;
450 mailinfo
) : plumbing
;;
451 mailsplit
) : plumbing
;;
452 merge-
*) : plumbing
;;
455 pack-objects
) : plumbing
;;
456 pack-redundant
) : plumbing
;;
457 pack-refs
) : plumbing
;;
458 parse-remote
) : plumbing
;;
459 patch-id
) : plumbing
;;
460 peek-remote
) : plumbing
;;
462 prune-packed
) : plumbing
;;
463 quiltimport
) : import
;;
464 read-tree
) : plumbing
;;
465 receive-pack
) : plumbing
;;
467 repo-config
) : deprecated
;;
469 rev-list
) : plumbing
;;
470 rev-parse
) : plumbing
;;
471 runstatus
) : plumbing
;;
472 sh-setup
) : internal
;;
474 show-ref
) : plumbing
;;
475 send-pack
) : plumbing
;;
476 show-index
) : plumbing
;;
478 stripspace
) : plumbing
;;
479 symbolic-ref
) : plumbing
;;
480 tar-tree
) : deprecated
;;
481 unpack-file
) : plumbing
;;
482 unpack-objects
) : plumbing
;;
483 update-index
) : plumbing
;;
484 update-ref
) : plumbing
;;
485 update-server-info
) : daemon
;;
486 upload-archive
) : plumbing
;;
487 upload-pack
) : plumbing
;;
488 write-tree
) : plumbing
;;
490 verify-pack
) : infrequent
;;
491 verify-tag
) : plumbing
;;
496 __git_porcelain_commandlist
=
497 __git_porcelain_commandlist
="$(__git_porcelain_commands 2>/dev/null)"
502 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
512 # __git_aliased_command requires 1 argument
513 __git_aliased_command
()
515 local word cmdline
=$
(git
--git-dir="$(__gitdir)" \
516 config
--get "alias.$1")
517 for word
in $cmdline; do
518 if [ "${word##-*}" ]; then
525 # __git_find_subcommand requires 1 argument
526 __git_find_subcommand
()
528 local word subcommand c
=1
530 while [ $c -lt $COMP_CWORD ]; do
531 word
="${COMP_WORDS[c]}"
532 for subcommand
in $1; do
533 if [ "$subcommand" = "$word" ]; then
542 __git_has_doubledash
()
545 while [ $c -lt $COMP_CWORD ]; do
546 if [ "--" = "${COMP_WORDS[c]}" ]; then
554 __git_whitespacelist
="nowarn warn error error-all fix"
558 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
559 if [ -d "$dir"/rebase-apply
]; then
560 __gitcomp
"--skip --resolved --abort"
565 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
570 --signoff --utf8 --binary --3way --interactive
580 local cur
="${COMP_WORDS[COMP_CWORD]}"
583 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
588 --stat --numstat --summary --check --index
589 --cached --index-info --reverse --reject --unidiff-zero
590 --apply --no-add --exclude=
591 --whitespace= --inaccurate-eof --verbose
600 __git_has_doubledash
&& return
602 local cur
="${COMP_WORDS[COMP_CWORD]}"
606 --interactive --refresh --patch --update --dry-run
607 --ignore-errors --intent-to-add
616 local cur
="${COMP_WORDS[COMP_CWORD]}"
619 __gitcomp
"$(git archive --list)" "" "${cur##--format=}"
623 __gitcomp
"$(__git_remotes)" "" "${cur##--remote=}"
628 --format= --list --verbose
629 --prefix= --remote= --exec=
639 __git_has_doubledash
&& return
641 local subcommands
="start bad good skip reset visualize replay log run"
642 local subcommand
="$(__git_find_subcommand "$subcommands")"
643 if [ -z "$subcommand" ]; then
644 __gitcomp
"$subcommands"
648 case "$subcommand" in
650 __gitcomp
"$(__git_refs)"
660 local i c
=1 only_local_ref
="n" has_r
="n"
662 while [ $c -lt $COMP_CWORD ]; do
665 -d|
-m) only_local_ref
="y" ;;
671 case "${COMP_WORDS[COMP_CWORD]}" in
674 --color --no-color --verbose --abbrev= --no-abbrev
675 --track --no-track --contains --merged --no-merged
679 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
680 __gitcomp
"$(__git_heads)"
682 __gitcomp
"$(__git_refs)"
690 local cmd
="${COMP_WORDS[2]}"
691 case "$COMP_CWORD" in
693 __gitcomp
"create list-heads verify unbundle"
701 __git_complete_revlist
710 __git_has_doubledash
&& return
712 __gitcomp
"$(__git_refs)"
717 __gitcomp
"$(__git_refs)"
722 local cur
="${COMP_WORDS[COMP_CWORD]}"
725 __gitcomp
"--edit --no-commit"
728 __gitcomp
"$(__git_refs)"
735 __git_has_doubledash
&& return
737 local cur
="${COMP_WORDS[COMP_CWORD]}"
740 __gitcomp
"--dry-run --quiet"
749 local cur
="${COMP_WORDS[COMP_CWORD]}"
774 __git_has_doubledash
&& return
776 local cur
="${COMP_WORDS[COMP_CWORD]}"
780 --all --author= --signoff --verify --no-verify
781 --edit --amend --include --only --interactive
790 local cur
="${COMP_WORDS[COMP_CWORD]}"
794 --all --tags --contains --abbrev= --candidates=
795 --exact-match --debug --long --match --always
799 __gitcomp
"$(__git_refs)"
802 __git_diff_common_options
="--stat --numstat --shortstat --summary
803 --patch-with-stat --name-only --name-status --color
804 --no-color --color-words --no-renames --check
805 --full-index --binary --abbrev --diff-filter=
807 --text --ignore-space-at-eol --ignore-space-change
808 --ignore-all-space --exit-code --quiet --ext-diff
810 --no-prefix --src-prefix= --dst-prefix=
811 --inter-hunk-context=
818 __git_has_doubledash
&& return
820 local cur
="${COMP_WORDS[COMP_CWORD]}"
823 __gitcomp
"--cached --pickaxe-all --pickaxe-regex
824 --base --ours --theirs
825 $__git_diff_common_options
835 local cur
="${COMP_WORDS[COMP_CWORD]}"
837 if [ "$COMP_CWORD" = 2 ]; then
838 __gitcomp
"$(__git_remotes)"
843 case "$COMP_WORDBREAKS" in
845 *) pfx
="${cur%%:*}:" ;;
847 __gitcomp
"$(__git_refs)" "$pfx" "${cur#*:}"
850 __gitcomp
"$(__git_refs2 "${COMP_WORDS[2]}")"
858 local cur
="${COMP_WORDS[COMP_CWORD]}"
862 --stdout --attach --thread
864 --numbered --start-number
869 --full-index --binary
872 --no-prefix --src-prefix= --dst-prefix=
873 --inline --suffix= --ignore-if-in-upstream
879 __git_complete_revlist
884 local cur
="${COMP_WORDS[COMP_CWORD]}"
887 __gitcomp
"--prune --aggressive"
896 __git_has_doubledash
&& return
898 local cur
="${COMP_WORDS[COMP_CWORD]}"
903 --text --ignore-case --word-regexp --invert-match
905 --extended-regexp --basic-regexp --fixed-strings
906 --files-with-matches --name-only
907 --files-without-match
909 --and --or --not --all-match
919 local cur
="${COMP_WORDS[COMP_CWORD]}"
922 __gitcomp
"--all --info --man --web"
926 __gitcomp
"$(__git_all_commands)
927 attributes cli core-tutorial cvs-migration
928 diffcore gitk glossary hooks ignore modules
929 repository-layout tutorial tutorial-2
936 local cur
="${COMP_WORDS[COMP_CWORD]}"
940 false true umask group all world everybody
941 " "" "${cur##--shared=}"
945 __gitcomp
"--quiet --bare --template= --shared --shared="
954 __git_has_doubledash
&& return
956 local cur
="${COMP_WORDS[COMP_CWORD]}"
959 __gitcomp
"--cached --deleted --modified --others --ignored
960 --stage --directory --no-empty-directory --unmerged
961 --killed --exclude= --exclude-from=
962 --exclude-per-directory= --exclude-standard
963 --error-unmatch --with-tree= --full-name
964 --abbrev --ignored --exclude-per-directory
974 __gitcomp
"$(__git_remotes)"
982 __git_log_pretty_formats
="oneline short medium full fuller email raw format:"
986 __git_has_doubledash
&& return
988 local cur
="${COMP_WORDS[COMP_CWORD]}"
991 __gitcomp
"$__git_log_pretty_formats
992 " "" "${cur##--pretty=}"
997 relative iso8601 rfc2822 short local default
998 " "" "${cur##--date=}"
1003 --max-count= --max-age= --since= --after=
1004 --min-age= --before= --until=
1005 --root --topo-order --date-order --reverse
1006 --no-merges --follow
1007 --abbrev-commit --abbrev=
1008 --relative-date --date=
1009 --author= --committer= --grep=
1013 --left-right --cherry-pick
1017 --parents --children --full-history
1019 $__git_diff_common_options
1020 --pickaxe-all --pickaxe-regex
1025 __git_complete_revlist
1030 local cur
="${COMP_WORDS[COMP_CWORD]}"
1031 case "${COMP_WORDS[COMP_CWORD-1]}" in
1033 __gitcomp
"$(__git_merge_strategies)"
1038 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
1043 --no-commit --no-stat --log --no-log --squash --strategy
1047 __gitcomp
"$(__git_refs)"
1052 local cur
="${COMP_WORDS[COMP_CWORD]}"
1056 kdiff3 tkdiff meld xxdiff emerge
1057 vimdiff gvimdiff ecmerge opendiff
1058 " "" "${cur##--tool=}"
1071 __gitcomp
"$(__git_refs)"
1076 local cur
="${COMP_WORDS[COMP_CWORD]}"
1079 __gitcomp
"--dry-run"
1088 __gitcomp
"--tags --all --stdin"
1093 local cur
="${COMP_WORDS[COMP_CWORD]}"
1095 if [ "$COMP_CWORD" = 2 ]; then
1096 __gitcomp
"$(__git_remotes)"
1098 __gitcomp
"$(__git_refs "${COMP_WORDS[2]}")"
1104 local cur
="${COMP_WORDS[COMP_CWORD]}"
1106 if [ "$COMP_CWORD" = 2 ]; then
1107 __gitcomp
"$(__git_remotes)"
1112 case "$COMP_WORDBREAKS" in
1114 *) pfx
="${cur%%:*}:" ;;
1117 __gitcomp
"$(__git_refs "${COMP_WORDS[2]}")" "$pfx" "${cur#*:}"
1120 __gitcomp
"$(__git_refs)" + "${cur#+}"
1123 __gitcomp
"$(__git_refs)"
1131 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
1132 if [ -d "$dir"/rebase-apply
] ||
[ -d "$dir"/rebase-merge
]; then
1133 __gitcomp
"--continue --skip --abort"
1136 case "${COMP_WORDS[COMP_CWORD-1]}" in
1138 __gitcomp
"$(__git_merge_strategies)"
1143 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
1147 __gitcomp
"--onto --merge --strategy --interactive"
1150 __gitcomp
"$(__git_refs)"
1155 local cur
="${COMP_WORDS[COMP_CWORD]}"
1158 __gitcomp
"--bcc --cc --cc-cmd --chain-reply-to --compose
1159 --dry-run --envelope-sender --from --identity
1160 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
1161 --no-suppress-from --no-thread --quiet
1162 --signed-off-by-cc --smtp-pass --smtp-server
1163 --smtp-server-port --smtp-ssl --smtp-user --subject
1164 --suppress-cc --suppress-from --thread --to
1165 --validate --no-validate"
1174 local cur
="${COMP_WORDS[COMP_CWORD]}"
1175 local prv
="${COMP_WORDS[COMP_CWORD-1]}"
1178 __gitcomp
"$(__git_remotes)"
1182 __gitcomp
"$(__git_refs)"
1186 local remote
="${prv#remote.}"
1187 remote
="${remote%.fetch}"
1188 __gitcomp
"$(__git_refs_remotes "$remote")"
1192 local remote
="${prv#remote.}"
1193 remote
="${remote%.push}"
1194 __gitcomp
"$(git --git-dir="$
(__gitdir
)" \
1195 for-each-ref --format='%(refname):%(refname)' \
1199 pull.twohead|pull.octopus
)
1200 __gitcomp
"$(__git_merge_strategies)"
1203 color.branch|color.
diff|color.status
)
1204 __gitcomp
"always never auto"
1209 normal black red green yellow blue magenta cyan white
1210 bold dim ul blink reverse
1222 --global --system --file=
1223 --list --replace-all
1224 --get --get-all --get-regexp
1225 --add --unset --unset-all
1226 --remove-section --rename-section
1231 local pfx
="${cur%.*}."
1233 __gitcomp
"remote merge mergeoptions" "$pfx" "$cur"
1237 local pfx
="${cur%.*}."
1239 __gitcomp
"$(__git_heads)" "$pfx" "$cur" "."
1243 local pfx
="${cur%.*}."
1246 url proxy fetch push mirror skipDefaultUpdate
1247 receivepack uploadpack tagopt
1252 local pfx
="${cur%.*}."
1254 __gitcomp
"$(__git_remotes)" "$pfx" "$cur" "."
1260 branch.autosetupmerge
1261 branch.autosetuprebase
1264 color.branch.current
1275 color.diff.whitespace
1277 color.interactive.header
1278 color.interactive.help
1279 color.interactive.prompt
1283 color.status.changed
1285 color.status.nobranch
1286 color.status.untracked
1287 color.status.updated
1293 core.deltaBaseCacheLimit
1297 core.fsyncobjectfiles
1299 core.ignoreCygwinFSTricks
1301 core.logAllRefUpdates
1302 core.loosecompression
1304 core.packedGitWindowSize
1306 core.preferSymlinkRefs
1309 core.repositoryFormatVersion
1311 core.sharedRepository
1314 core.warnAmbiguousRefs
1317 diff.autorefreshindex
1334 gc.reflogexpireunreachable
1338 gitcvs.dbTableNamePrefix
1348 gui.copyblamethreshold
1352 gui.matchtrackingbranch
1353 gui.newbranchtemplate
1354 gui.pruneduringfetch
1355 gui.spellingdictionary
1371 i18n.logOutputEncoding
1386 mergetool.keepBackup
1388 pack.deltaCacheLimit
1398 receive.denyCurrentBranch
1400 receive.denyNonFastForwards
1403 repack.usedeltabaseoffset
1407 status.relativePaths
1408 status.showUntrackedFiles
1410 transfer.unpackLimit
1421 local subcommands
="add rename rm show prune update"
1422 local subcommand
="$(__git_find_subcommand "$subcommands")"
1423 if [ -z "$subcommand" ]; then
1424 __gitcomp
"$subcommands"
1428 case "$subcommand" in
1429 rename|
rm|show|prune
)
1430 __gitcomp
"$(__git_remotes)"
1433 local i c
='' IFS
=$
'\n'
1434 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
1452 __git_has_doubledash
&& return
1454 local cur
="${COMP_WORDS[COMP_CWORD]}"
1457 __gitcomp
"--merge --mixed --hard --soft"
1461 __gitcomp
"$(__git_refs)"
1466 local cur
="${COMP_WORDS[COMP_CWORD]}"
1469 __gitcomp
"--edit --mainline --no-edit --no-commit --signoff"
1473 __gitcomp
"$(__git_refs)"
1478 __git_has_doubledash
&& return
1480 local cur
="${COMP_WORDS[COMP_CWORD]}"
1483 __gitcomp
"--cached --dry-run --ignore-unmatch --quiet"
1492 __git_has_doubledash
&& return
1494 local cur
="${COMP_WORDS[COMP_CWORD]}"
1498 --max-count= --max-age= --since= --after=
1499 --min-age= --before= --until=
1501 --author= --committer= --grep=
1504 --numbered --summary
1509 __git_complete_revlist
1514 __git_has_doubledash
&& return
1516 local cur
="${COMP_WORDS[COMP_CWORD]}"
1519 __gitcomp
"$__git_log_pretty_formats
1520 " "" "${cur##--pretty=}"
1524 __gitcomp
"--pretty=
1525 $__git_diff_common_options
1535 local cur
="${COMP_WORDS[COMP_CWORD]}"
1539 --all --remotes --topo-order --current --more=
1540 --list --independent --merge-base --no-name
1541 --sha1-name --topics --reflog
1546 __git_complete_revlist
1551 local subcommands
='save list show apply clear drop pop create branch'
1552 local subcommand
="$(__git_find_subcommand "$subcommands")"
1553 if [ -z "$subcommand" ]; then
1554 __gitcomp
"$subcommands"
1556 local cur
="${COMP_WORDS[COMP_CWORD]}"
1557 case "$subcommand,$cur" in
1559 __gitcomp
"--keep-index"
1564 show
,--*|drop
,--*|pop
,--*|branch
,--*)
1567 show
,*|apply
,*|drop
,*|pop
,*|branch
,*)
1568 __gitcomp
"$(git --git-dir="$
(__gitdir
)" stash list \
1569 | sed -n -e 's/:.*//p')"
1580 __git_has_doubledash
&& return
1582 local subcommands
="add status init update summary foreach sync"
1583 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1584 local cur
="${COMP_WORDS[COMP_CWORD]}"
1587 __gitcomp
"--quiet --cached"
1590 __gitcomp
"$subcommands"
1600 init fetch clone rebase dcommit log find-rev
1601 set-tree commit-diff info create-ignore propget
1602 proplist show-ignore show-externals
1604 local subcommand
="$(__git_find_subcommand "$subcommands")"
1605 if [ -z "$subcommand" ]; then
1606 __gitcomp
"$subcommands"
1608 local remote_opts
="--username= --config-dir= --no-auth-cache"
1610 --follow-parent --authors-file= --repack=
1611 --no-metadata --use-svm-props --use-svnsync-props
1612 --log-window-size= --no-checkout --quiet
1613 --repack-flags --user-log-author --localtime $remote_opts
1616 --template= --shared= --trunk= --tags=
1617 --branches= --stdlayout --minimize-url
1618 --no-metadata --use-svm-props --use-svnsync-props
1619 --rewrite-root= $remote_opts
1622 --edit --rmdir --find-copies-harder --copy-similarity=
1625 local cur
="${COMP_WORDS[COMP_CWORD]}"
1626 case "$subcommand,$cur" in
1628 __gitcomp
"--revision= --fetch-all $fc_opts"
1631 __gitcomp
"--revision= $fc_opts $init_opts"
1634 __gitcomp
"$init_opts"
1638 --merge --strategy= --verbose --dry-run
1639 --fetch-all --no-rebase $cmt_opts $fc_opts
1643 __gitcomp
"--stdin $cmt_opts $fc_opts"
1645 create-ignore
,--*|propget
,--*|proplist
,--*|show-ignore
,--*|\
1647 __gitcomp
"--revision="
1651 --limit= --revision= --verbose --incremental
1652 --oneline --show-commit --non-recursive
1658 --merge --verbose --strategy= --local
1659 --fetch-all $fc_opts
1663 __gitcomp
"--message= --file= --revision= $cmt_opts"
1678 while [ $c -lt $COMP_CWORD ]; do
1679 i
="${COMP_WORDS[c]}"
1682 __gitcomp
"$(__git_tags)"
1692 case "${COMP_WORDS[COMP_CWORD-1]}" in
1698 __gitcomp
"$(__git_tags)"
1704 __gitcomp
"$(__git_refs)"
1711 local i c
=1 command __git_dir
1713 while [ $c -lt $COMP_CWORD ]; do
1714 i
="${COMP_WORDS[c]}"
1716 --git-dir=*) __git_dir
="${i#--git-dir=}" ;;
1717 --bare) __git_dir
="." ;;
1718 --version|
-p|
--paginate) ;;
1719 --help) command="help"; break ;;
1720 *) command="$i"; break ;;
1725 if [ -z "$command" ]; then
1726 case "${COMP_WORDS[COMP_CWORD]}" in
1738 *) __gitcomp
"$(__git_porcelain_commands) $(__git_aliases)" ;;
1743 local expansion
=$
(__git_aliased_command
"$command")
1744 [ "$expansion" ] && command="$expansion"
1749 apply
) _git_apply
;;
1750 archive
) _git_archive
;;
1751 bisect
) _git_bisect
;;
1752 bundle
) _git_bundle
;;
1753 branch
) _git_branch
;;
1754 checkout
) _git_checkout
;;
1755 cherry
) _git_cherry
;;
1756 cherry-pick
) _git_cherry_pick
;;
1757 clean
) _git_clean
;;
1758 clone
) _git_clone
;;
1759 commit
) _git_commit
;;
1760 config
) _git_config
;;
1761 describe
) _git_describe
;;
1763 fetch
) _git_fetch
;;
1764 format-patch
) _git_format_patch
;;
1770 ls-files
) _git_ls_files
;;
1771 ls-remote
) _git_ls_remote
;;
1772 ls-tree
) _git_ls_tree
;;
1774 mergetool
) _git_mergetool
;;
1775 merge-base
) _git_merge_base
;;
1777 name-rev
) _git_name_rev
;;
1780 rebase
) _git_rebase
;;
1781 remote
) _git_remote
;;
1782 reset) _git_reset
;;
1783 revert
) _git_revert
;;
1785 send-email
) _git_send_email
;;
1786 shortlog
) _git_shortlog
;;
1788 show-branch
) _git_show_branch
;;
1789 stash
) _git_stash
;;
1791 submodule
) _git_submodule
;;
1794 whatchanged
) _git_log
;;
1801 __git_has_doubledash
&& return
1803 local cur
="${COMP_WORDS[COMP_CWORD]}"
1804 local g
="$(__gitdir)"
1806 if [ -f $g/MERGE_HEAD
]; then
1811 __gitcomp
"--not --all $merge"
1815 __git_complete_revlist
1818 complete
-o bashdefault
-o default
-o nospace
-F _git git
2>/dev
/null \
1819 || complete
-o default
-o nospace
-F _git git
1820 complete
-o bashdefault
-o default
-o nospace
-F _gitk gitk
2>/dev
/null \
1821 || complete
-o default
-o nospace
-F _gitk gitk
1823 # The following are necessary only for Cygwin, and only are needed
1824 # when the user has tab-completed the executable name and consequently
1825 # included the '.exe' suffix.
1827 if [ Cygwin
= "$(uname -o 2>/dev/null)" ]; then
1828 complete
-o bashdefault
-o default
-o nospace
-F _git git.exe
2>/dev
/null \
1829 || complete
-o default
-o nospace
-F _git git.exe