bash: Support unique completion when possible.
[alt-git.git] / contrib / completion / git-completion.bash
blob3b1f100f1b27d02d0d923ce2cac3ea087c1da499
2 # bash completion support for core Git.
4 # Copyright (C) 2006,2007 Shawn Pearce
5 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
7 # The contained completion routines provide support for completing:
9 # *) local and remote branch names
10 # *) local and remote tag names
11 # *) .git/remotes file names
12 # *) git 'subcommands'
13 # *) tree paths within 'ref:path/to/file' expressions
15 # To use these routines:
17 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
18 # 2) Added the following line to your .bashrc:
19 # source ~/.git-completion.sh
21 # 3) You may want to make sure the git executable is available
22 # in your PATH before this script is sourced, as some caching
23 # is performed while the script loads. If git isn't found
24 # at source time then all lookups will be done on demand,
25 # which may be slightly slower.
27 # 4) Consider changing your PS1 to also show the current branch:
28 # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
30 # The argument to __git_ps1 will be displayed only if you
31 # are currently in a git repository. The %s token will be
32 # the name of the current branch.
35 __gitdir ()
37 if [ -z "$1" ]; then
38 if [ -n "$__git_dir" ]; then
39 echo "$__git_dir"
40 elif [ -d .git ]; then
41 echo .git
42 else
43 git rev-parse --git-dir 2>/dev/null
45 elif [ -d "$1/.git" ]; then
46 echo "$1/.git"
47 else
48 echo "$1"
52 __git_ps1 ()
54 local b="$(git symbolic-ref HEAD 2>/dev/null)"
55 if [ -n "$b" ]; then
56 if [ -n "$1" ]; then
57 printf "$1" "${b##refs/heads/}"
58 else
59 printf " (%s)" "${b##refs/heads/}"
64 __gitcomp ()
66 local all c s=$'\n' IFS=' '$'\t'$'\n'
67 local cur="${COMP_WORDS[COMP_CWORD]}"
68 if [ $# -gt 2 ]; then
69 cur="$3"
71 for c in $1; do
72 case "$c$4" in
73 --*=*) all="$all$c$4$s" ;;
74 *.) all="$all$c$4$s" ;;
75 *) all="$all$c$4 $s" ;;
76 esac
77 done
78 IFS=$s
79 COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
80 return
83 __git_heads ()
85 local cmd i is_hash=y dir="$(__gitdir "$1")"
86 if [ -d "$dir" ]; then
87 for i in $(git --git-dir="$dir" \
88 for-each-ref --format='%(refname)' \
89 refs/heads ); do
90 echo "${i#refs/heads/}"
91 done
92 return
94 for i in $(git-ls-remote "$1" 2>/dev/null); do
95 case "$is_hash,$i" in
96 y,*) is_hash=n ;;
97 n,*^{}) is_hash=y ;;
98 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
99 n,*) is_hash=y; echo "$i" ;;
100 esac
101 done
104 __git_refs ()
106 local cmd i is_hash=y dir="$(__gitdir "$1")"
107 if [ -d "$dir" ]; then
108 if [ -e "$dir/HEAD" ]; then echo HEAD; fi
109 for i in $(git --git-dir="$dir" \
110 for-each-ref --format='%(refname)' \
111 refs/tags refs/heads refs/remotes); do
112 case "$i" in
113 refs/tags/*) echo "${i#refs/tags/}" ;;
114 refs/heads/*) echo "${i#refs/heads/}" ;;
115 refs/remotes/*) echo "${i#refs/remotes/}" ;;
116 *) echo "$i" ;;
117 esac
118 done
119 return
121 for i in $(git-ls-remote "$dir" 2>/dev/null); do
122 case "$is_hash,$i" in
123 y,*) is_hash=n ;;
124 n,*^{}) is_hash=y ;;
125 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
126 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
127 n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
128 n,*) is_hash=y; echo "$i" ;;
129 esac
130 done
133 __git_refs2 ()
135 local i
136 for i in $(__git_refs "$1"); do
137 echo "$i:$i"
138 done
141 __git_refs_remotes ()
143 local cmd i is_hash=y
144 for i in $(git-ls-remote "$1" 2>/dev/null); do
145 case "$is_hash,$i" in
146 n,refs/heads/*)
147 is_hash=y
148 echo "$i:refs/remotes/$1/${i#refs/heads/}"
150 y,*) is_hash=n ;;
151 n,*^{}) is_hash=y ;;
152 n,refs/tags/*) is_hash=y;;
153 n,*) is_hash=y; ;;
154 esac
155 done
158 __git_remotes ()
160 local i ngoff IFS=$'\n' d="$(__gitdir)"
161 shopt -q nullglob || ngoff=1
162 shopt -s nullglob
163 for i in "$d/remotes"/*; do
164 echo ${i#$d/remotes/}
165 done
166 [ "$ngoff" ] && shopt -u nullglob
167 for i in $(git --git-dir="$d" config --list); do
168 case "$i" in
169 remote.*.url=*)
170 i="${i#remote.}"
171 echo "${i/.url=*/}"
173 esac
174 done
177 __git_merge_strategies ()
179 if [ -n "$__git_merge_strategylist" ]; then
180 echo "$__git_merge_strategylist"
181 return
183 sed -n "/^all_strategies='/{
184 s/^all_strategies='//
185 s/'//
188 }" "$(git --exec-path)/git-merge"
190 __git_merge_strategylist=
191 __git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
193 __git_complete_file ()
195 local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
196 case "$cur" in
197 ?*:*)
198 ref="${cur%%:*}"
199 cur="${cur#*:}"
200 case "$cur" in
201 ?*/*)
202 pfx="${cur%/*}"
203 cur="${cur##*/}"
204 ls="$ref:$pfx"
205 pfx="$pfx/"
208 ls="$ref"
210 esac
211 COMPREPLY=($(compgen -P "$pfx" \
212 -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
213 | sed '/^100... blob /s,^.* ,,
214 /^040000 tree /{
215 s,^.* ,,
216 s,$,/,
218 s/^.* //')" \
219 -- "$cur"))
222 __gitcomp "$(__git_refs)"
224 esac
227 __git_complete_revlist ()
229 local pfx cur="${COMP_WORDS[COMP_CWORD]}"
230 case "$cur" in
231 *...*)
232 pfx="${cur%...*}..."
233 cur="${cur#*...}"
234 __gitcomp "$(__git_refs)" "$pfx" "$cur"
236 *..*)
237 pfx="${cur%..*}.."
238 cur="${cur#*..}"
239 __gitcomp "$(__git_refs)" "$pfx" "$cur"
242 __gitcomp "$cur."
245 __gitcomp "$(__git_refs)"
247 esac
250 __git_commands ()
252 if [ -n "$__git_commandlist" ]; then
253 echo "$__git_commandlist"
254 return
256 local i IFS=" "$'\n'
257 for i in $(git help -a|egrep '^ ')
259 case $i in
260 add--interactive) : plumbing;;
261 applymbox) : ask gittus;;
262 applypatch) : ask gittus;;
263 archimport) : import;;
264 cat-file) : plumbing;;
265 check-ref-format) : plumbing;;
266 commit-tree) : plumbing;;
267 convert-objects) : plumbing;;
268 cvsexportcommit) : export;;
269 cvsimport) : import;;
270 cvsserver) : daemon;;
271 daemon) : daemon;;
272 fsck-objects) : plumbing;;
273 fetch-pack) : plumbing;;
274 fmt-merge-msg) : plumbing;;
275 hash-object) : plumbing;;
276 http-*) : transport;;
277 index-pack) : plumbing;;
278 init-db) : deprecated;;
279 local-fetch) : plumbing;;
280 mailinfo) : plumbing;;
281 mailsplit) : plumbing;;
282 merge-*) : plumbing;;
283 mktree) : plumbing;;
284 mktag) : plumbing;;
285 pack-objects) : plumbing;;
286 pack-redundant) : plumbing;;
287 pack-refs) : plumbing;;
288 parse-remote) : plumbing;;
289 patch-id) : plumbing;;
290 peek-remote) : plumbing;;
291 prune) : plumbing;;
292 prune-packed) : plumbing;;
293 quiltimport) : import;;
294 read-tree) : plumbing;;
295 receive-pack) : plumbing;;
296 reflog) : plumbing;;
297 repo-config) : plumbing;;
298 rerere) : plumbing;;
299 rev-list) : plumbing;;
300 rev-parse) : plumbing;;
301 runstatus) : plumbing;;
302 sh-setup) : internal;;
303 shell) : daemon;;
304 send-pack) : plumbing;;
305 show-index) : plumbing;;
306 ssh-*) : transport;;
307 stripspace) : plumbing;;
308 svn) : import export;;
309 svnimport) : import;;
310 symbolic-ref) : plumbing;;
311 tar-tree) : deprecated;;
312 unpack-file) : plumbing;;
313 unpack-objects) : plumbing;;
314 update-index) : plumbing;;
315 update-ref) : plumbing;;
316 update-server-info) : daemon;;
317 upload-archive) : plumbing;;
318 upload-pack) : plumbing;;
319 write-tree) : plumbing;;
320 verify-tag) : plumbing;;
321 *) echo $i;;
322 esac
323 done
325 __git_commandlist=
326 __git_commandlist="$(__git_commands 2>/dev/null)"
328 __git_aliases ()
330 local i IFS=$'\n'
331 for i in $(git --git-dir="$(__gitdir)" config --list); do
332 case "$i" in
333 alias.*)
334 i="${i#alias.}"
335 echo "${i/=*/}"
337 esac
338 done
341 __git_aliased_command ()
343 local word cmdline=$(git --git-dir="$(__gitdir)" \
344 config --get "alias.$1")
345 for word in $cmdline; do
346 if [ "${word##-*}" ]; then
347 echo $word
348 return
350 done
353 __git_whitespacelist="nowarn warn error error-all strip"
355 _git_am ()
357 local cur="${COMP_WORDS[COMP_CWORD]}"
358 if [ -d .dotest ]; then
359 __gitcomp "--skip --resolved"
360 return
362 case "$cur" in
363 --whitespace=*)
364 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
365 return
367 --*)
368 __gitcomp "
369 --signoff --utf8 --binary --3way --interactive
370 --whitespace=
372 return
373 esac
374 COMPREPLY=()
377 _git_apply ()
379 local cur="${COMP_WORDS[COMP_CWORD]}"
380 case "$cur" in
381 --whitespace=*)
382 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
383 return
385 --*)
386 __gitcomp "
387 --stat --numstat --summary --check --index
388 --cached --index-info --reverse --reject --unidiff-zero
389 --apply --no-add --exclude=
390 --whitespace= --inaccurate-eof --verbose
392 return
393 esac
394 COMPREPLY=()
397 _git_add ()
399 local cur="${COMP_WORDS[COMP_CWORD]}"
400 case "$cur" in
401 --*)
402 __gitcomp "--interactive"
403 return
404 esac
405 COMPREPLY=()
408 _git_branch ()
410 __gitcomp "$(__git_refs)"
413 _git_checkout ()
415 __gitcomp "$(__git_refs)"
418 _git_cherry_pick ()
420 local cur="${COMP_WORDS[COMP_CWORD]}"
421 case "$cur" in
422 --*)
423 __gitcomp "--edit --no-commit"
426 __gitcomp "$(__git_refs)"
428 esac
431 _git_commit ()
433 local cur="${COMP_WORDS[COMP_CWORD]}"
434 case "$cur" in
435 --*)
436 __gitcomp "
437 --all --author= --signoff --verify --no-verify
438 --edit --amend --include --only
440 return
441 esac
442 COMPREPLY=()
445 _git_diff ()
447 __git_complete_file
450 _git_diff_tree ()
452 __gitcomp "$(__git_refs)"
455 _git_fetch ()
457 local cur="${COMP_WORDS[COMP_CWORD]}"
459 case "${COMP_WORDS[0]},$COMP_CWORD" in
460 git-fetch*,1)
461 __gitcomp "$(__git_remotes)"
463 git,2)
464 __gitcomp "$(__git_remotes)"
467 case "$cur" in
468 *:*)
469 __gitcomp "$(__git_refs)" "" "${cur#*:}"
472 local remote
473 case "${COMP_WORDS[0]}" in
474 git-fetch) remote="${COMP_WORDS[1]}" ;;
475 git) remote="${COMP_WORDS[2]}" ;;
476 esac
477 __gitcomp "$(__git_refs2 "$remote")"
479 esac
481 esac
484 _git_format_patch ()
486 local cur="${COMP_WORDS[COMP_CWORD]}"
487 case "$cur" in
488 --*)
489 __gitcomp "
490 --stdout --attach --thread
491 --output-directory
492 --numbered --start-number
493 --keep-subject
494 --signoff
495 --in-reply-to=
496 --full-index --binary
498 return
500 esac
501 __git_complete_revlist
504 _git_ls_remote ()
506 __gitcomp "$(__git_remotes)"
509 _git_ls_tree ()
511 __git_complete_file
514 _git_log ()
516 local cur="${COMP_WORDS[COMP_CWORD]}"
517 case "$cur" in
518 --pretty=*)
519 __gitcomp "
520 oneline short medium full fuller email raw
521 " "" "${cur##--pretty=}"
522 return
524 --*)
525 __gitcomp "
526 --max-count= --max-age= --since= --after=
527 --min-age= --before= --until=
528 --root --not --topo-order --date-order
529 --no-merges
530 --abbrev-commit --abbrev=
531 --relative-date
532 --author= --committer= --grep=
533 --all-match
534 --pretty= --name-status --name-only
536 return
538 esac
539 __git_complete_revlist
542 _git_merge ()
544 local cur="${COMP_WORDS[COMP_CWORD]}"
545 case "${COMP_WORDS[COMP_CWORD-1]}" in
546 -s|--strategy)
547 __gitcomp "$(__git_merge_strategies)"
548 return
549 esac
550 case "$cur" in
551 --strategy=*)
552 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
553 return
555 --*)
556 __gitcomp "
557 --no-commit --no-summary --squash --strategy
559 return
560 esac
561 __gitcomp "$(__git_refs)"
564 _git_merge_base ()
566 __gitcomp "$(__git_refs)"
569 _git_name_rev ()
571 __gitcomp "--tags --all --stdin"
574 _git_pull ()
576 local cur="${COMP_WORDS[COMP_CWORD]}"
578 case "${COMP_WORDS[0]},$COMP_CWORD" in
579 git-pull*,1)
580 __gitcomp "$(__git_remotes)"
582 git,2)
583 __gitcomp "$(__git_remotes)"
586 local remote
587 case "${COMP_WORDS[0]}" in
588 git-pull) remote="${COMP_WORDS[1]}" ;;
589 git) remote="${COMP_WORDS[2]}" ;;
590 esac
591 __gitcomp "$(__git_refs "$remote")"
593 esac
596 _git_push ()
598 local cur="${COMP_WORDS[COMP_CWORD]}"
600 case "${COMP_WORDS[0]},$COMP_CWORD" in
601 git-push*,1)
602 __gitcomp "$(__git_remotes)"
604 git,2)
605 __gitcomp "$(__git_remotes)"
608 case "$cur" in
609 *:*)
610 local remote
611 case "${COMP_WORDS[0]}" in
612 git-push) remote="${COMP_WORDS[1]}" ;;
613 git) remote="${COMP_WORDS[2]}" ;;
614 esac
615 __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
618 __gitcomp "$(__git_refs2)"
620 esac
622 esac
625 _git_rebase ()
627 local cur="${COMP_WORDS[COMP_CWORD]}"
628 if [ -d .dotest ]; then
629 __gitcomp "--continue --skip --abort"
630 return
632 case "${COMP_WORDS[COMP_CWORD-1]}" in
633 -s|--strategy)
634 __gitcomp "$(__git_merge_strategies)"
635 return
636 esac
637 case "$cur" in
638 --strategy=*)
639 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
640 return
642 --*)
643 __gitcomp "--onto --merge --strategy"
644 return
645 esac
646 __gitcomp "$(__git_refs)"
649 _git_config ()
651 local cur="${COMP_WORDS[COMP_CWORD]}"
652 local prv="${COMP_WORDS[COMP_CWORD-1]}"
653 case "$prv" in
654 branch.*.remote)
655 __gitcomp "$(__git_remotes)"
656 return
658 branch.*.merge)
659 __gitcomp "$(__git_refs)"
660 return
662 remote.*.fetch)
663 local remote="${prv#remote.}"
664 remote="${remote%.fetch}"
665 __gitcomp "$(__git_refs_remotes "$remote")"
666 return
668 remote.*.push)
669 local remote="${prv#remote.}"
670 remote="${remote%.push}"
671 __gitcomp "$(git --git-dir="$(__gitdir)" \
672 for-each-ref --format='%(refname):%(refname)' \
673 refs/heads)"
674 return
676 pull.twohead|pull.octopus)
677 __gitcomp "$(__git_merge_strategies)"
678 return
680 color.branch|color.diff|color.status)
681 __gitcomp "always never auto"
682 return
684 color.*.*)
685 __gitcomp "
686 black red green yellow blue magenta cyan white
687 bold dim ul blink reverse
689 return
691 *.*)
692 COMPREPLY=()
693 return
695 esac
696 case "$cur" in
697 --*)
698 __gitcomp "
699 --global --list --replace-all
700 --get --get-all --get-regexp
701 --unset --unset-all
703 return
705 branch.*.*)
706 local pfx="${cur%.*}."
707 cur="${cur##*.}"
708 __gitcomp "remote merge" "$pfx" "$cur"
709 return
711 branch.*)
712 local pfx="${cur%.*}."
713 cur="${cur#*.}"
714 __gitcomp "$(__git_heads)" "$pfx" "$cur" "."
715 return
717 remote.*.*)
718 local pfx="${cur%.*}."
719 cur="${cur##*.}"
720 __gitcomp "url fetch push" "$pfx" "$cur"
721 return
723 remote.*)
724 local pfx="${cur%.*}."
725 cur="${cur#*.}"
726 __gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
727 return
729 esac
730 __gitcomp "
731 apply.whitespace
732 core.fileMode
733 core.gitProxy
734 core.ignoreStat
735 core.preferSymlinkRefs
736 core.logAllRefUpdates
737 core.repositoryFormatVersion
738 core.sharedRepository
739 core.warnAmbiguousRefs
740 core.compression
741 core.legacyHeaders
742 core.packedGitWindowSize
743 core.packedGitLimit
744 color.branch
745 color.branch.current
746 color.branch.local
747 color.branch.remote
748 color.branch.plain
749 color.diff
750 color.diff.plain
751 color.diff.meta
752 color.diff.frag
753 color.diff.old
754 color.diff.new
755 color.diff.commit
756 color.diff.whitespace
757 color.pager
758 color.status
759 color.status.header
760 color.status.added
761 color.status.changed
762 color.status.untracked
763 diff.renameLimit
764 diff.renames
765 fetch.unpackLimit
766 format.headers
767 gitcvs.enabled
768 gitcvs.logfile
769 gc.reflogexpire
770 gc.reflogexpireunreachable
771 gc.rerereresolved
772 gc.rerereunresolved
773 http.sslVerify
774 http.sslCert
775 http.sslKey
776 http.sslCAInfo
777 http.sslCAPath
778 http.maxRequests
779 http.lowSpeedLimit
780 http.lowSpeedTime
781 http.noEPSV
782 i18n.commitEncoding
783 i18n.logOutputEncoding
784 log.showroot
785 merge.summary
786 merge.verbosity
787 pack.window
788 pull.octopus
789 pull.twohead
790 repack.useDeltaBaseOffset
791 show.difftree
792 showbranch.default
793 tar.umask
794 transfer.unpackLimit
795 receive.unpackLimit
796 receive.denyNonFastForwards
797 user.name
798 user.email
799 user.signingkey
800 whatchanged.difftree
801 branch. remote.
805 _git_reset ()
807 local cur="${COMP_WORDS[COMP_CWORD]}"
808 case "$cur" in
809 --*)
810 __gitcomp "--mixed --hard --soft"
811 return
813 esac
814 __gitcomp "$(__git_refs)"
817 _git_show ()
819 local cur="${COMP_WORDS[COMP_CWORD]}"
820 case "$cur" in
821 --pretty=*)
822 __gitcomp "
823 oneline short medium full fuller email raw
824 " "" "${cur##--pretty=}"
825 return
827 --*)
828 __gitcomp "--pretty="
829 return
831 esac
832 __git_complete_file
835 _git ()
837 local i c=1 command __git_dir
839 while [ $c -lt $COMP_CWORD ]; do
840 i="${COMP_WORDS[c]}"
841 case "$i" in
842 --git-dir=*) __git_dir="${i#--git-dir=}" ;;
843 --bare) __git_dir="." ;;
844 --version|--help|-p|--paginate) ;;
845 *) command="$i"; break ;;
846 esac
847 c=$((++c))
848 done
850 if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
851 case "${COMP_WORDS[COMP_CWORD]}" in
852 --*=*) COMPREPLY=() ;;
853 --*) __gitcomp "--git-dir= --bare --version --exec-path" ;;
854 *) __gitcomp "$(__git_commands) $(__git_aliases)" ;;
855 esac
856 return
859 local expansion=$(__git_aliased_command "$command")
860 [ "$expansion" ] && command="$expansion"
862 case "$command" in
863 am) _git_am ;;
864 add) _git_add ;;
865 apply) _git_apply ;;
866 branch) _git_branch ;;
867 checkout) _git_checkout ;;
868 cherry-pick) _git_cherry_pick ;;
869 commit) _git_commit ;;
870 config) _git_config ;;
871 diff) _git_diff ;;
872 diff-tree) _git_diff_tree ;;
873 fetch) _git_fetch ;;
874 format-patch) _git_format_patch ;;
875 log) _git_log ;;
876 ls-remote) _git_ls_remote ;;
877 ls-tree) _git_ls_tree ;;
878 merge) _git_merge;;
879 merge-base) _git_merge_base ;;
880 name-rev) _git_name_rev ;;
881 pull) _git_pull ;;
882 push) _git_push ;;
883 rebase) _git_rebase ;;
884 reset) _git_reset ;;
885 show) _git_show ;;
886 show-branch) _git_log ;;
887 whatchanged) _git_log ;;
888 *) COMPREPLY=() ;;
889 esac
892 _gitk ()
894 local cur="${COMP_WORDS[COMP_CWORD]}"
895 case "$cur" in
896 --*)
897 __gitcomp "--not --all"
898 return
900 esac
901 __gitcomp "$(__git_refs)"
904 complete -o default -o nospace -F _git git
905 complete -o default -o nospace -F _gitk gitk
906 complete -o default -o nospace -F _git_am git-am
907 complete -o default -o nospace -F _git_apply git-apply
908 complete -o default -o nospace -F _git_branch git-branch
909 complete -o default -o nospace -F _git_checkout git-checkout
910 complete -o default -o nospace -F _git_cherry_pick git-cherry-pick
911 complete -o default -o nospace -F _git_commit git-commit
912 complete -o default -o nospace -F _git_diff git-diff
913 complete -o default -o nospace -F _git_diff_tree git-diff-tree
914 complete -o default -o nospace -F _git_fetch git-fetch
915 complete -o default -o nospace -F _git_format_patch git-format-patch
916 complete -o default -o nospace -F _git_log git-log
917 complete -o default -o nospace -F _git_ls_remote git-ls-remote
918 complete -o default -o nospace -F _git_ls_tree git-ls-tree
919 complete -o default -o nospace -F _git_merge git-merge
920 complete -o default -o nospace -F _git_merge_base git-merge-base
921 complete -o default -o nospace -F _git_name_rev git-name-rev
922 complete -o default -o nospace -F _git_pull git-pull
923 complete -o default -o nospace -F _git_push git-push
924 complete -o default -o nospace -F _git_rebase git-rebase
925 complete -o default -o nospace -F _git_config git-config
926 complete -o default -o nospace -F _git_reset git-reset
927 complete -o default -o nospace -F _git_show git-show
928 complete -o default -o nospace -F _git_log git-show-branch
929 complete -o default -o nospace -F _git_log git-whatchanged
931 # The following are necessary only for Cygwin, and only are needed
932 # when the user has tab-completed the executable name and consequently
933 # included the '.exe' suffix.
935 if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
936 complete -o default -o nospace -F _git_add git-add.exe
937 complete -o default -o nospace -F _git_apply git-apply.exe
938 complete -o default -o nospace -F _git git.exe
939 complete -o default -o nospace -F _git_branch git-branch.exe
940 complete -o default -o nospace -F _git_diff git-diff.exe
941 complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe
942 complete -o default -o nospace -F _git_format_patch git-format-patch.exe
943 complete -o default -o nospace -F _git_log git-log.exe
944 complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
945 complete -o default -o nospace -F _git_merge_base git-merge-base.exe
946 complete -o default -o nospace -F _git_name_rev git-name-rev.exe
947 complete -o default -o nospace -F _git_push git-push.exe
948 complete -o default -o nospace -F _git_config git-config
949 complete -o default -o nospace -F _git_show git-show.exe
950 complete -o default -o nospace -F _git_log git-show-branch.exe
951 complete -o default -o nospace -F _git_log git-whatchanged.exe