2 # bash completion support for core Git.
4 # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
5 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
6 # Distributed under the GNU General Public License, version 2.0.
8 # The contained completion routines provide support for completing:
10 # *) local and remote branch names
11 # *) local and remote tag names
12 # *) .git/remotes file names
13 # *) git 'subcommands'
14 # *) tree paths within 'ref:path/to/file' expressions
15 # *) common --long-options
17 # To use these routines:
19 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
20 # 2) Added the following line to your .bashrc:
21 # source ~/.git-completion.sh
23 # 3) You may want to make sure the git executable is available
24 # in your PATH before this script is sourced, as some caching
25 # is performed while the script loads. If git isn't found
26 # at source time then all lookups will be done on demand,
27 # which may be slightly slower.
29 # 4) Consider changing your PS1 to also show the current branch:
30 # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
32 # The argument to __git_ps1 will be displayed only if you
33 # are currently in a git repository. The %s token will be
34 # the name of the current branch.
38 # *) Read Documentation/SubmittingPatches
39 # *) Send all patches to the current maintainer:
41 # "Shawn O. Pearce" <spearce@spearce.org>
43 # *) Always CC the Git mailing list:
51 if [ -n "$__git_dir" ]; then
53 elif [ -d .git
]; then
56 git rev-parse
--git-dir 2>/dev
/null
58 elif [ -d "$1/.git" ]; then
67 local g
="$(git rev-parse --git-dir 2>/dev/null)"
71 if [ -d "$g/../.dotest" ]
73 if test -f "$g/../.dotest/rebasing"
76 elif test -f "$g/../.dotest/applying"
82 b
="$(git symbolic-ref HEAD 2>/dev/null)"
83 elif [ -f "$g/.dotest-merge/interactive" ]
86 b
="$(cat "$g/.dotest-merge
/head-name
")"
87 elif [ -d "$g/.dotest-merge" ]
90 b
="$(cat "$g/.dotest-merge
/head-name
")"
91 elif [ -f "$g/MERGE_HEAD" ]
94 b
="$(git symbolic-ref HEAD 2>/dev/null)"
96 if [ -f "$g/BISECT_LOG" ]
100 if ! b
="$(git symbolic-ref HEAD 2>/dev/null)"
102 if ! b
="$(git describe --exact-match HEAD 2>/dev/null)"
104 b
="$(cut -c1-7 "$g/HEAD
")..."
110 printf "$1" "${b##refs/heads/}$r"
112 printf " (%s)" "${b##refs/heads/}$r"
119 local all c s
=$
'\n' IFS
=' '$
'\t'$
'\n'
120 local cur
="${COMP_WORDS[COMP_CWORD]}"
121 if [ $# -gt 2 ]; then
132 --*=*) all
="$all$c$4$s" ;;
133 *.
) all
="$all$c$4$s" ;;
134 *) all
="$all$c$4 $s" ;;
140 COMPREPLY
=($
(compgen
-P "$2" -W "$all" -- "$cur"))
146 local cmd i is_hash
=y dir
="$(__gitdir "$1")"
147 if [ -d "$dir" ]; then
148 for i
in $
(git
--git-dir="$dir" \
149 for-each-ref
--format='%(refname)' \
151 echo "${i#refs/heads/}"
155 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
156 case "$is_hash,$i" in
159 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
160 n
,*) is_hash
=y
; echo "$i" ;;
167 local cmd i is_hash
=y dir
="$(__gitdir "$1")"
168 if [ -d "$dir" ]; then
169 for i
in $
(git
--git-dir="$dir" \
170 for-each-ref
--format='%(refname)' \
172 echo "${i#refs/tags/}"
176 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
177 case "$is_hash,$i" in
180 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
181 n
,*) is_hash
=y
; echo "$i" ;;
188 local cmd i is_hash
=y dir
="$(__gitdir "$1")"
189 if [ -d "$dir" ]; then
190 if [ -e "$dir/HEAD" ]; then echo HEAD
; fi
191 for i
in $
(git
--git-dir="$dir" \
192 for-each-ref
--format='%(refname)' \
193 refs
/tags refs
/heads refs
/remotes
); do
195 refs
/tags
/*) echo "${i#refs/tags/}" ;;
196 refs
/heads
/*) echo "${i#refs/heads/}" ;;
197 refs
/remotes
/*) echo "${i#refs/remotes/}" ;;
203 for i
in $
(git ls-remote
"$dir" 2>/dev
/null
); do
204 case "$is_hash,$i" in
207 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
208 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
209 n
,refs
/remotes
/*) is_hash
=y
; echo "${i#refs/remotes/}" ;;
210 n
,*) is_hash
=y
; echo "$i" ;;
218 for i
in $
(__git_refs
"$1"); do
223 __git_refs_remotes
()
225 local cmd i is_hash
=y
226 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
227 case "$is_hash,$i" in
230 echo "$i:refs/remotes/$1/${i#refs/heads/}"
234 n
,refs
/tags
/*) is_hash
=y
;;
242 local i ngoff IFS
=$
'\n' d
="$(__gitdir)"
243 shopt -q nullglob || ngoff
=1
245 for i
in "$d/remotes"/*; do
246 echo ${i#$d/remotes/}
248 [ "$ngoff" ] && shopt -u nullglob
249 for i
in $
(git
--git-dir="$d" config
--list); do
259 __git_merge_strategies
()
261 if [ -n "$__git_merge_strategylist" ]; then
262 echo "$__git_merge_strategylist"
265 sed -n "/^all_strategies='/{
266 s/^all_strategies='//
270 }" "$(git --exec-path)/git-merge"
272 __git_merge_strategylist
=
273 __git_merge_strategylist
="$(__git_merge_strategies 2>/dev/null)"
275 __git_complete_file
()
277 local pfx
ls ref cur
="${COMP_WORDS[COMP_CWORD]}"
293 COMPREPLY
=($
(compgen
-P "$pfx" \
294 -W "$(git --git-dir="$
(__gitdir
)" ls-tree "$ls" \
295 | sed '/^100... blob /s,^.* ,,
304 __gitcomp
"$(__git_refs)"
309 __git_complete_revlist
()
311 local pfx cur
="${COMP_WORDS[COMP_CWORD]}"
316 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
321 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
327 __gitcomp
"$(__git_refs)"
334 if [ -n "$__git_commandlist" ]; then
335 echo "$__git_commandlist"
339 for i
in $
(git
help -a|
egrep '^ ')
342 *--*) : helper pattern
;;
343 applymbox
) : ask gittus
;;
344 applypatch
) : ask gittus
;;
345 archimport
) : import
;;
346 cat-file
) : plumbing
;;
347 check-attr
) : plumbing
;;
348 check-ref-format
) : plumbing
;;
349 commit-tree
) : plumbing
;;
350 cvsexportcommit
) : export;;
351 cvsimport
) : import
;;
352 cvsserver
) : daemon
;;
354 diff-files
) : plumbing
;;
355 diff-index
) : plumbing
;;
356 diff-tree
) : plumbing
;;
357 fast-import
) : import
;;
358 fsck-objects
) : plumbing
;;
359 fetch-pack
) : plumbing
;;
360 fmt-merge-msg
) : plumbing
;;
361 for-each-ref
) : plumbing
;;
362 hash-object
) : plumbing
;;
363 http-
*) : transport
;;
364 index-pack
) : plumbing
;;
365 init-db
) : deprecated
;;
366 local-fetch
) : plumbing
;;
367 mailinfo
) : plumbing
;;
368 mailsplit
) : plumbing
;;
369 merge-
*) : plumbing
;;
372 pack-objects
) : plumbing
;;
373 pack-redundant
) : plumbing
;;
374 pack-refs
) : plumbing
;;
375 parse-remote
) : plumbing
;;
376 patch-id
) : plumbing
;;
377 peek-remote
) : plumbing
;;
379 prune-packed
) : plumbing
;;
380 quiltimport
) : import
;;
381 read-tree
) : plumbing
;;
382 receive-pack
) : plumbing
;;
384 repo-config
) : deprecated
;;
386 rev-list
) : plumbing
;;
387 rev-parse
) : plumbing
;;
388 runstatus
) : plumbing
;;
389 sh-setup
) : internal
;;
391 send-pack
) : plumbing
;;
392 show-index
) : plumbing
;;
394 stripspace
) : plumbing
;;
395 symbolic-ref
) : plumbing
;;
396 tar-tree
) : deprecated
;;
397 unpack-file
) : plumbing
;;
398 unpack-objects
) : plumbing
;;
399 update-index
) : plumbing
;;
400 update-ref
) : plumbing
;;
401 update-server-info
) : daemon
;;
402 upload-archive
) : plumbing
;;
403 upload-pack
) : plumbing
;;
404 write-tree
) : plumbing
;;
405 verify-tag
) : plumbing
;;
411 __git_commandlist
="$(__git_commands 2>/dev/null)"
416 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
426 __git_aliased_command
()
428 local word cmdline
=$
(git
--git-dir="$(__gitdir)" \
429 config
--get "alias.$1")
430 for word
in $cmdline; do
431 if [ "${word##-*}" ]; then
438 __git_find_subcommand
()
440 local word subcommand c
=1
442 while [ $c -lt $COMP_CWORD ]; do
443 word
="${COMP_WORDS[c]}"
444 for subcommand
in $1; do
445 if [ "$subcommand" = "$word" ]; then
454 __git_has_doubledash
()
457 while [ $c -lt $COMP_CWORD ]; do
458 if [ "--" = "${COMP_WORDS[c]}" ]; then
466 __git_whitespacelist
="nowarn warn error error-all strip"
470 local cur
="${COMP_WORDS[COMP_CWORD]}"
471 if [ -d .dotest
]; then
472 __gitcomp
"--skip --resolved"
477 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
482 --signoff --utf8 --binary --3way --interactive
492 local cur
="${COMP_WORDS[COMP_CWORD]}"
495 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
500 --stat --numstat --summary --check --index
501 --cached --index-info --reverse --reject --unidiff-zero
502 --apply --no-add --exclude=
503 --whitespace= --inaccurate-eof --verbose
512 __git_has_doubledash
&& return
514 local cur
="${COMP_WORDS[COMP_CWORD]}"
518 --interactive --refresh --patch --update --dry-run
528 __git_has_doubledash
&& return
530 local subcommands
="start bad good skip reset visualize replay log run"
531 local subcommand
="$(__git_find_subcommand "$subcommands")"
532 if [ -z "$subcommand" ]; then
533 __gitcomp
"$subcommands"
537 case "$subcommand" in
539 __gitcomp
"$(__git_refs)"
549 local i c
=1 only_local_ref
="n" has_r
="n"
551 while [ $c -lt $COMP_CWORD ]; do
554 -d|
-m) only_local_ref
="y" ;;
560 case "${COMP_WORDS[COMP_CWORD]}" in
561 --*=*) COMPREPLY
=() ;;
564 --color --no-color --verbose --abbrev= --no-abbrev
565 --track --no-track --contains --merged --no-merged
569 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
570 __gitcomp
"$(__git_heads)"
572 __gitcomp
"$(__git_refs)"
580 local mycword
="$COMP_CWORD"
581 case "${COMP_WORDS[0]}" in
583 local cmd
="${COMP_WORDS[2]}"
584 mycword
="$((mycword-1))"
587 local cmd
="${COMP_WORDS[1]}"
592 __gitcomp
"create list-heads verify unbundle"
600 __git_complete_revlist
609 __gitcomp
"$(__git_refs)"
614 __gitcomp
"$(__git_refs)"
619 local cur
="${COMP_WORDS[COMP_CWORD]}"
622 __gitcomp
"--edit --no-commit"
625 __gitcomp
"$(__git_refs)"
632 __git_has_doubledash
&& return
634 local cur
="${COMP_WORDS[COMP_CWORD]}"
638 --all --author= --signoff --verify --no-verify
639 --edit --amend --include --only
648 __gitcomp
"$(__git_refs)"
653 __git_has_doubledash
&& return
655 local cur
="${COMP_WORDS[COMP_CWORD]}"
658 __gitcomp
"--cached --stat --numstat --shortstat --summary
659 --patch-with-stat --name-only --name-status --color
660 --no-color --color-words --no-renames --check
661 --full-index --binary --abbrev --diff-filter
662 --find-copies-harder --pickaxe-all --pickaxe-regex
663 --text --ignore-space-at-eol --ignore-space-change
664 --ignore-all-space --exit-code --quiet --ext-diff
666 --no-prefix --src-prefix= --dst-prefix=
667 --base --ours --theirs
677 __gitcomp
"$(__git_refs)"
682 local cur
="${COMP_WORDS[COMP_CWORD]}"
684 case "${COMP_WORDS[0]},$COMP_CWORD" in
686 __gitcomp
"$(__git_remotes)"
689 __gitcomp
"$(__git_remotes)"
694 __gitcomp
"$(__git_refs)" "" "${cur#*:}"
698 case "${COMP_WORDS[0]}" in
699 git-fetch
) remote
="${COMP_WORDS[1]}" ;;
700 git
) remote
="${COMP_WORDS[2]}" ;;
702 __gitcomp
"$(__git_refs2 "$remote")"
711 local cur
="${COMP_WORDS[COMP_CWORD]}"
715 --stdout --attach --thread
717 --numbered --start-number
722 --full-index --binary
725 --no-prefix --src-prefix= --dst-prefix=
730 __git_complete_revlist
735 local cur
="${COMP_WORDS[COMP_CWORD]}"
738 __gitcomp
"--prune --aggressive"
747 __gitcomp
"$(__git_remotes)"
757 __git_has_doubledash
&& return
759 local cur
="${COMP_WORDS[COMP_CWORD]}"
763 oneline short medium full fuller email raw
764 " "" "${cur##--pretty=}"
769 relative iso8601 rfc2822 short local default
770 " "" "${cur##--date=}"
775 --max-count= --max-age= --since= --after=
776 --min-age= --before= --until=
777 --root --topo-order --date-order --reverse
779 --abbrev-commit --abbrev=
780 --relative-date --date=
781 --author= --committer= --grep=
783 --pretty= --name-status --name-only --raw
785 --left-right --cherry-pick
787 --stat --numstat --shortstat
788 --decorate --diff-filter=
789 --color-words --walk-reflogs
794 __git_complete_revlist
799 local cur
="${COMP_WORDS[COMP_CWORD]}"
800 case "${COMP_WORDS[COMP_CWORD-1]}" in
802 __gitcomp
"$(__git_merge_strategies)"
807 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
812 --no-commit --no-stat --log --no-log --squash --strategy
816 __gitcomp
"$(__git_refs)"
821 __gitcomp
"$(__git_refs)"
826 __gitcomp
"--tags --all --stdin"
831 local cur
="${COMP_WORDS[COMP_CWORD]}"
833 case "${COMP_WORDS[0]},$COMP_CWORD" in
835 __gitcomp
"$(__git_remotes)"
838 __gitcomp
"$(__git_remotes)"
842 case "${COMP_WORDS[0]}" in
843 git-pull
) remote
="${COMP_WORDS[1]}" ;;
844 git
) remote
="${COMP_WORDS[2]}" ;;
846 __gitcomp
"$(__git_refs "$remote")"
853 local cur
="${COMP_WORDS[COMP_CWORD]}"
855 case "${COMP_WORDS[0]},$COMP_CWORD" in
857 __gitcomp
"$(__git_remotes)"
860 __gitcomp
"$(__git_remotes)"
866 case "${COMP_WORDS[0]}" in
867 git-push
) remote
="${COMP_WORDS[1]}" ;;
868 git
) remote
="${COMP_WORDS[2]}" ;;
870 __gitcomp
"$(__git_refs "$remote")" "" "${cur#*:}"
873 __gitcomp
"$(__git_refs)" + "${cur#+}"
876 __gitcomp
"$(__git_refs)"
885 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
886 if [ -d .dotest
] ||
[ -d "$dir"/.dotest-merge
]; then
887 __gitcomp
"--continue --skip --abort"
890 case "${COMP_WORDS[COMP_CWORD-1]}" in
892 __gitcomp
"$(__git_merge_strategies)"
897 __gitcomp
"$(__git_merge_strategies)" "" "${cur##--strategy=}"
901 __gitcomp
"--onto --merge --strategy --interactive"
904 __gitcomp
"$(__git_refs)"
909 local cur
="${COMP_WORDS[COMP_CWORD]}"
910 local prv
="${COMP_WORDS[COMP_CWORD-1]}"
913 __gitcomp
"$(__git_remotes)"
917 __gitcomp
"$(__git_refs)"
921 local remote
="${prv#remote.}"
922 remote
="${remote%.fetch}"
923 __gitcomp
"$(__git_refs_remotes "$remote")"
927 local remote
="${prv#remote.}"
928 remote
="${remote%.push}"
929 __gitcomp
"$(git --git-dir="$
(__gitdir
)" \
930 for-each-ref --format='%(refname):%(refname)' \
934 pull.twohead|pull.octopus
)
935 __gitcomp
"$(__git_merge_strategies)"
938 color.branch|color.
diff|color.status
)
939 __gitcomp
"always never auto"
944 black red green yellow blue magenta cyan white
945 bold dim ul blink reverse
957 --global --system --file=
959 --get --get-all --get-regexp
960 --add --unset --unset-all
961 --remove-section --rename-section
966 local pfx
="${cur%.*}."
968 __gitcomp
"remote merge" "$pfx" "$cur"
972 local pfx
="${cur%.*}."
974 __gitcomp
"$(__git_heads)" "$pfx" "$cur" "."
978 local pfx
="${cur%.*}."
981 url fetch push skipDefaultUpdate
982 receivepack uploadpack tagopt
987 local pfx
="${cur%.*}."
989 __gitcomp
"$(__git_remotes)" "$pfx" "$cur" "."
998 core.preferSymlinkRefs
999 core.logAllRefUpdates
1000 core.loosecompression
1001 core.repositoryFormatVersion
1002 core.sharedRepository
1003 core.warnAmbiguousRefs
1005 core.packedGitWindowSize
1009 color.branch.current
1020 color.diff.whitespace
1025 color.status.changed
1026 color.status.untracked
1031 format.subjectprefix
1035 gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dbpass
1036 gitcvs.dbtablenameprefix
1039 gc.reflogexpireunreachable
1052 i18n.logOutputEncoding
1062 pack.deltaCacheLimit
1065 repack.useDeltaBaseOffset
1068 transfer.unpackLimit
1070 receive.denyNonFastForwards
1080 local subcommands
="add rm show prune update"
1081 local subcommand
="$(__git_find_subcommand "$subcommands")"
1082 if [ -z "$subcommand" ]; then
1083 __gitcomp
"$subcommands"
1087 case "$subcommand" in
1089 __gitcomp
"$(__git_remotes)"
1092 local i c
='' IFS
=$
'\n'
1093 for i
in $
(git
--git-dir="$(__gitdir)" config
--list); do
1111 __git_has_doubledash
&& return
1113 local cur
="${COMP_WORDS[COMP_CWORD]}"
1116 __gitcomp
"--mixed --hard --soft"
1120 __gitcomp
"$(__git_refs)"
1125 __git_has_doubledash
&& return
1127 local cur
="${COMP_WORDS[COMP_CWORD]}"
1131 --max-count= --max-age= --since= --after=
1132 --min-age= --before= --until=
1134 --author= --committer= --grep=
1137 --numbered --summary
1142 __git_complete_revlist
1147 local cur
="${COMP_WORDS[COMP_CWORD]}"
1151 oneline short medium full fuller email raw
1152 " "" "${cur##--pretty=}"
1156 __gitcomp
"--pretty="
1165 local subcommands
='save list show apply clear drop pop create'
1166 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1167 __gitcomp
"$subcommands"
1173 __git_has_doubledash
&& return
1175 local subcommands
="add status init update"
1176 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1177 local cur
="${COMP_WORDS[COMP_CWORD]}"
1180 __gitcomp
"--quiet --cached"
1183 __gitcomp
"$subcommands"
1193 init fetch clone rebase dcommit log find-rev
1194 set-tree commit-diff info create-ignore propget
1195 proplist show-ignore show-externals
1197 local subcommand
="$(__git_find_subcommand "$subcommands")"
1198 if [ -z "$subcommand" ]; then
1199 __gitcomp
"$subcommands"
1201 local remote_opts
="--username= --config-dir= --no-auth-cache"
1203 --follow-parent --authors-file= --repack=
1204 --no-metadata --use-svm-props --use-svnsync-props
1205 --log-window-size= --no-checkout --quiet
1206 --repack-flags --user-log-author $remote_opts
1209 --template= --shared= --trunk= --tags=
1210 --branches= --stdlayout --minimize-url
1211 --no-metadata --use-svm-props --use-svnsync-props
1212 --rewrite-root= $remote_opts
1215 --edit --rmdir --find-copies-harder --copy-similarity=
1218 local cur
="${COMP_WORDS[COMP_CWORD]}"
1219 case "$subcommand,$cur" in
1221 __gitcomp
"--revision= --fetch-all $fc_opts"
1224 __gitcomp
"--revision= $fc_opts $init_opts"
1227 __gitcomp
"$init_opts"
1231 --merge --strategy= --verbose --dry-run
1232 --fetch-all --no-rebase $cmt_opts $fc_opts
1236 __gitcomp
"--stdin $cmt_opts $fc_opts"
1238 create-ignore
,--*|propget
,--*|proplist
,--*|show-ignore
,--*|\
1240 __gitcomp
"--revision="
1244 --limit= --revision= --verbose --incremental
1245 --oneline --show-commit --non-recursive
1251 --merge --verbose --strategy= --local
1252 --fetch-all $fc_opts
1256 __gitcomp
"--message= --file= --revision= $cmt_opts"
1271 while [ $c -lt $COMP_CWORD ]; do
1272 i
="${COMP_WORDS[c]}"
1275 __gitcomp
"$(__git_tags)"
1285 case "${COMP_WORDS[COMP_CWORD-1]}" in
1291 __gitcomp
"$(__git_tags)"
1297 __gitcomp
"$(__git_refs)"
1304 local i c
=1 command __git_dir
1306 while [ $c -lt $COMP_CWORD ]; do
1307 i
="${COMP_WORDS[c]}"
1309 --git-dir=*) __git_dir
="${i#--git-dir=}" ;;
1310 --bare) __git_dir
="." ;;
1311 --version|
--help|
-p|
--paginate) ;;
1312 *) command="$i"; break ;;
1317 if [ -z "$command" ]; then
1318 case "${COMP_WORDS[COMP_CWORD]}" in
1319 --*=*) COMPREPLY
=() ;;
1331 *) __gitcomp
"$(__git_commands) $(__git_aliases)" ;;
1336 local expansion
=$
(__git_aliased_command
"$command")
1337 [ "$expansion" ] && command="$expansion"
1342 apply
) _git_apply
;;
1343 bisect
) _git_bisect
;;
1344 bundle
) _git_bundle
;;
1345 branch
) _git_branch
;;
1346 checkout
) _git_checkout
;;
1347 cherry
) _git_cherry
;;
1348 cherry-pick
) _git_cherry_pick
;;
1349 commit
) _git_commit
;;
1350 config
) _git_config
;;
1351 describe
) _git_describe
;;
1353 fetch
) _git_fetch
;;
1354 format-patch
) _git_format_patch
;;
1357 ls-remote
) _git_ls_remote
;;
1358 ls-tree
) _git_ls_tree
;;
1360 merge-base
) _git_merge_base
;;
1361 name-rev
) _git_name_rev
;;
1364 rebase
) _git_rebase
;;
1365 remote
) _git_remote
;;
1366 reset) _git_reset
;;
1367 shortlog
) _git_shortlog
;;
1369 show-branch
) _git_log
;;
1370 stash
) _git_stash
;;
1371 submodule
) _git_submodule
;;
1374 whatchanged
) _git_log
;;
1381 __git_has_doubledash
&& return
1383 local cur
="${COMP_WORDS[COMP_CWORD]}"
1384 local g
="$(git rev-parse --git-dir 2>/dev/null)"
1386 if [ -f $g/MERGE_HEAD
]; then
1391 __gitcomp
"--not --all $merge"
1395 __git_complete_revlist
1398 complete
-o default
-o nospace
-F _git git
1399 complete
-o default
-o nospace
-F _gitk gitk
1400 complete
-o default
-o nospace
-F _git_am git-am
1401 complete
-o default
-o nospace
-F _git_apply git-apply
1402 complete
-o default
-o nospace
-F _git_bisect git-bisect
1403 complete
-o default
-o nospace
-F _git_branch git-branch
1404 complete
-o default
-o nospace
-F _git_bundle git-bundle
1405 complete
-o default
-o nospace
-F _git_checkout git-checkout
1406 complete
-o default
-o nospace
-F _git_cherry git-cherry
1407 complete
-o default
-o nospace
-F _git_cherry_pick git-cherry-pick
1408 complete
-o default
-o nospace
-F _git_commit git-commit
1409 complete
-o default
-o nospace
-F _git_describe git-describe
1410 complete
-o default
-o nospace
-F _git_diff git-diff
1411 complete
-o default
-o nospace
-F _git_fetch git-fetch
1412 complete
-o default
-o nospace
-F _git_format_patch git-format-patch
1413 complete
-o default
-o nospace
-F _git_gc git-gc
1414 complete
-o default
-o nospace
-F _git_log git-log
1415 complete
-o default
-o nospace
-F _git_ls_remote git-ls-remote
1416 complete
-o default
-o nospace
-F _git_ls_tree git-ls-tree
1417 complete
-o default
-o nospace
-F _git_merge git-merge
1418 complete
-o default
-o nospace
-F _git_merge_base git-merge-base
1419 complete
-o default
-o nospace
-F _git_name_rev git-name-rev
1420 complete
-o default
-o nospace
-F _git_pull git-pull
1421 complete
-o default
-o nospace
-F _git_push git-push
1422 complete
-o default
-o nospace
-F _git_rebase git-rebase
1423 complete
-o default
-o nospace
-F _git_config git-config
1424 complete
-o default
-o nospace
-F _git_remote git-remote
1425 complete
-o default
-o nospace
-F _git_reset git-reset
1426 complete
-o default
-o nospace
-F _git_shortlog git-shortlog
1427 complete
-o default
-o nospace
-F _git_show git-show
1428 complete
-o default
-o nospace
-F _git_stash git-stash
1429 complete
-o default
-o nospace
-F _git_submodule git-submodule
1430 complete
-o default
-o nospace
-F _git_svn git-svn
1431 complete
-o default
-o nospace
-F _git_log git-show-branch
1432 complete
-o default
-o nospace
-F _git_tag git-tag
1433 complete
-o default
-o nospace
-F _git_log git-whatchanged
1435 # The following are necessary only for Cygwin, and only are needed
1436 # when the user has tab-completed the executable name and consequently
1437 # included the '.exe' suffix.
1439 if [ Cygwin
= "$(uname -o 2>/dev/null)" ]; then
1440 complete
-o default
-o nospace
-F _git_add git-add.exe
1441 complete
-o default
-o nospace
-F _git_apply git-apply.exe
1442 complete
-o default
-o nospace
-F _git git.exe
1443 complete
-o default
-o nospace
-F _git_branch git-branch.exe
1444 complete
-o default
-o nospace
-F _git_bundle git-bundle.exe
1445 complete
-o default
-o nospace
-F _git_cherry git-cherry.exe
1446 complete
-o default
-o nospace
-F _git_describe git-describe.exe
1447 complete
-o default
-o nospace
-F _git_diff git-diff.exe
1448 complete
-o default
-o nospace
-F _git_format_patch git-format-patch.exe
1449 complete
-o default
-o nospace
-F _git_log git-log.exe
1450 complete
-o default
-o nospace
-F _git_ls_tree git-ls-tree.exe
1451 complete
-o default
-o nospace
-F _git_merge_base git-merge-base.exe
1452 complete
-o default
-o nospace
-F _git_name_rev git-name-rev.exe
1453 complete
-o default
-o nospace
-F _git_push git-push.exe
1454 complete
-o default
-o nospace
-F _git_config git-config
1455 complete
-o default
-o nospace
-F _git_shortlog git-shortlog.exe
1456 complete
-o default
-o nospace
-F _git_show git-show.exe
1457 complete
-o default
-o nospace
-F _git_log git-show-branch.exe
1458 complete
-o default
-o nospace
-F _git_tag git-tag.exe
1459 complete
-o default
-o nospace
-F _git_log git-whatchanged.exe