Teach bash the new features of 'git show'.
[git.git] / contrib / completion / git-completion.bash
blob234cd0954b888d814d8d4d86bb41983b80fddade
2 # bash completion support for core Git.
4 # Copyright (C) 2006 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 __git_heads ()
66 local cmd i is_hash=y dir="$(__gitdir "$1")"
67 if [ -d "$dir" ]; then
68 for i in $(git --git-dir="$dir" \
69 for-each-ref --format='%(refname)' \
70 refs/heads ); do
71 echo "${i#refs/heads/}"
72 done
73 return
75 for i in $(git-ls-remote "$1" 2>/dev/null); do
76 case "$is_hash,$i" in
77 y,*) is_hash=n ;;
78 n,*^{}) is_hash=y ;;
79 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
80 n,*) is_hash=y; echo "$i" ;;
81 esac
82 done
85 __git_refs ()
87 local cmd i is_hash=y dir="$(__gitdir "$1")"
88 if [ -d "$dir" ]; then
89 if [ -e "$dir/HEAD" ]; then echo HEAD; fi
90 for i in $(git --git-dir="$dir" \
91 for-each-ref --format='%(refname)' \
92 refs/tags refs/heads refs/remotes); do
93 case "$i" in
94 refs/tags/*) echo "${i#refs/tags/}" ;;
95 refs/heads/*) echo "${i#refs/heads/}" ;;
96 refs/remotes/*) echo "${i#refs/remotes/}" ;;
97 *) echo "$i" ;;
98 esac
99 done
100 return
102 for i in $(git-ls-remote "$dir" 2>/dev/null); do
103 case "$is_hash,$i" in
104 y,*) is_hash=n ;;
105 n,*^{}) is_hash=y ;;
106 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
107 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
108 n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
109 n,*) is_hash=y; echo "$i" ;;
110 esac
111 done
114 __git_refs2 ()
116 local i
117 for i in $(__git_refs "$1"); do
118 echo "$i:$i"
119 done
122 __git_refs_remotes ()
124 local cmd i is_hash=y
125 for i in $(git-ls-remote "$1" 2>/dev/null); do
126 case "$is_hash,$i" in
127 n,refs/heads/*)
128 is_hash=y
129 echo "$i:refs/remotes/$1/${i#refs/heads/}"
131 y,*) is_hash=n ;;
132 n,*^{}) is_hash=y ;;
133 n,refs/tags/*) is_hash=y;;
134 n,*) is_hash=y; ;;
135 esac
136 done
139 __git_remotes ()
141 local i ngoff IFS=$'\n' d="$(__gitdir)"
142 shopt -q nullglob || ngoff=1
143 shopt -s nullglob
144 for i in "$d/remotes"/*; do
145 echo ${i#$d/remotes/}
146 done
147 [ "$ngoff" ] && shopt -u nullglob
148 for i in $(git --git-dir="$d" repo-config --list); do
149 case "$i" in
150 remote.*.url=*)
151 i="${i#remote.}"
152 echo "${i/.url=*/}"
154 esac
155 done
158 __git_merge_strategies ()
160 if [ -n "$__git_merge_strategylist" ]; then
161 echo "$__git_merge_strategylist"
162 return
164 sed -n "/^all_strategies='/{
165 s/^all_strategies='//
166 s/'//
169 }" "$(git --exec-path)/git-merge"
171 __git_merge_strategylist=
172 __git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
174 __git_complete_file ()
176 local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
177 case "$cur" in
178 ?*:*)
179 ref="${cur%%:*}"
180 cur="${cur#*:}"
181 case "$cur" in
182 ?*/*)
183 pfx="${cur%/*}"
184 cur="${cur##*/}"
185 ls="$ref:$pfx"
186 pfx="$pfx/"
189 ls="$ref"
191 esac
192 COMPREPLY=($(compgen -P "$pfx" \
193 -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
194 | sed '/^100... blob /s,^.* ,,
195 /^040000 tree /{
196 s,^.* ,,
197 s,$,/,
199 s/^.* //')" \
200 -- "$cur"))
203 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
205 esac
208 __git_complete_revlist ()
210 local pfx cur="${COMP_WORDS[COMP_CWORD]}"
211 case "$cur" in
212 *...*)
213 pfx="${cur%...*}..."
214 cur="${cur#*...}"
215 COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
217 *..*)
218 pfx="${cur%..*}.."
219 cur="${cur#*..}"
220 COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
223 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
225 esac
228 __git_commands ()
230 if [ -n "$__git_commandlist" ]; then
231 echo "$__git_commandlist"
232 return
234 local i IFS=" "$'\n'
235 for i in $(git help -a|egrep '^ ')
237 case $i in
238 check-ref-format) : plumbing;;
239 commit-tree) : plumbing;;
240 convert-objects) : plumbing;;
241 cvsserver) : daemon;;
242 daemon) : daemon;;
243 fetch-pack) : plumbing;;
244 hash-object) : plumbing;;
245 http-*) : transport;;
246 index-pack) : plumbing;;
247 local-fetch) : plumbing;;
248 mailinfo) : plumbing;;
249 mailsplit) : plumbing;;
250 merge-*) : plumbing;;
251 mktree) : plumbing;;
252 mktag) : plumbing;;
253 pack-objects) : plumbing;;
254 pack-redundant) : plumbing;;
255 pack-refs) : plumbing;;
256 parse-remote) : plumbing;;
257 patch-id) : plumbing;;
258 peek-remote) : plumbing;;
259 read-tree) : plumbing;;
260 receive-pack) : plumbing;;
261 rerere) : plumbing;;
262 rev-list) : plumbing;;
263 rev-parse) : plumbing;;
264 runstatus) : plumbing;;
265 sh-setup) : internal;;
266 shell) : daemon;;
267 send-pack) : plumbing;;
268 show-index) : plumbing;;
269 ssh-*) : transport;;
270 stripspace) : plumbing;;
271 symbolic-ref) : plumbing;;
272 unpack-file) : plumbing;;
273 unpack-objects) : plumbing;;
274 update-ref) : plumbing;;
275 update-server-info) : daemon;;
276 upload-archive) : plumbing;;
277 upload-pack) : plumbing;;
278 write-tree) : plumbing;;
279 *) echo $i;;
280 esac
281 done
283 __git_commandlist=
284 __git_commandlist="$(__git_commands 2>/dev/null)"
286 __git_aliases ()
288 local i IFS=$'\n'
289 for i in $(git --git-dir="$(__gitdir)" repo-config --list); do
290 case "$i" in
291 alias.*)
292 i="${i#alias.}"
293 echo "${i/=*/}"
295 esac
296 done
299 __git_aliased_command ()
301 local word cmdline=$(git --git-dir="$(__gitdir)" \
302 repo-config --get "alias.$1")
303 for word in $cmdline; do
304 if [ "${word##-*}" ]; then
305 echo $word
306 return
308 done
311 __git_whitespacelist="nowarn warn error error-all strip"
313 _git_am ()
315 local cur="${COMP_WORDS[COMP_CWORD]}"
316 if [ -d .dotest ]; then
317 COMPREPLY=($(compgen -W "
318 --skip --resolved
319 " -- "$cur"))
320 return
322 case "$cur" in
323 --whitespace=*)
324 COMPREPLY=($(compgen -W "$__git_whitespacelist" \
325 -- "${cur##--whitespace=}"))
326 return
328 --*)
329 COMPREPLY=($(compgen -W "
330 --signoff --utf8 --binary --3way --interactive
331 --whitespace=
332 " -- "$cur"))
333 return
334 esac
335 COMPREPLY=()
338 _git_apply ()
340 local cur="${COMP_WORDS[COMP_CWORD]}"
341 case "$cur" in
342 --whitespace=*)
343 COMPREPLY=($(compgen -W "$__git_whitespacelist" \
344 -- "${cur##--whitespace=}"))
345 return
347 --*)
348 COMPREPLY=($(compgen -W "
349 --stat --numstat --summary --check --index
350 --cached --index-info --reverse --reject --unidiff-zero
351 --apply --no-add --exclude=
352 --whitespace= --inaccurate-eof --verbose
353 " -- "$cur"))
354 return
355 esac
356 COMPREPLY=()
359 _git_branch ()
361 local cur="${COMP_WORDS[COMP_CWORD]}"
362 COMPREPLY=($(compgen -W "-l -f -d -D $(__git_refs)" -- "$cur"))
365 _git_cat_file ()
367 local cur="${COMP_WORDS[COMP_CWORD]}"
368 case "${COMP_WORDS[0]},$COMP_CWORD" in
369 git-cat-file*,1)
370 COMPREPLY=($(compgen -W "-p -t blob tree commit tag" -- "$cur"))
372 git,2)
373 COMPREPLY=($(compgen -W "-p -t blob tree commit tag" -- "$cur"))
376 __git_complete_file
378 esac
381 _git_checkout ()
383 local cur="${COMP_WORDS[COMP_CWORD]}"
384 COMPREPLY=($(compgen -W "-l -b $(__git_refs)" -- "$cur"))
387 _git_cherry_pick ()
389 local cur="${COMP_WORDS[COMP_CWORD]}"
390 case "$cur" in
391 --*)
392 COMPREPLY=($(compgen -W "
393 --edit --no-commit
394 " -- "$cur"))
397 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
399 esac
402 _git_commit ()
404 local cur="${COMP_WORDS[COMP_CWORD]}"
405 case "$cur" in
406 --*)
407 COMPREPLY=($(compgen -W "
408 --all --author= --signoff --verify --no-verify
409 --edit --amend --include --only
410 " -- "$cur"))
411 return
412 esac
413 COMPREPLY=()
416 _git_diff ()
418 __git_complete_file
421 _git_diff_tree ()
423 local cur="${COMP_WORDS[COMP_CWORD]}"
424 COMPREPLY=($(compgen -W "-r -p -M $(__git_refs)" -- "$cur"))
427 _git_fetch ()
429 local cur="${COMP_WORDS[COMP_CWORD]}"
431 case "${COMP_WORDS[0]},$COMP_CWORD" in
432 git-fetch*,1)
433 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
435 git,2)
436 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
439 case "$cur" in
440 *:*)
441 cur="${cur#*:}"
442 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
445 local remote
446 case "${COMP_WORDS[0]}" in
447 git-fetch) remote="${COMP_WORDS[1]}" ;;
448 git) remote="${COMP_WORDS[2]}" ;;
449 esac
450 COMPREPLY=($(compgen -W "$(__git_refs2 "$remote")" -- "$cur"))
452 esac
454 esac
457 _git_format_patch ()
459 local cur="${COMP_WORDS[COMP_CWORD]}"
460 case "$cur" in
461 --*)
462 COMPREPLY=($(compgen -W "
463 --stdout --attach --thread
464 --output-directory
465 --numbered --start-number
466 --keep-subject
467 --signoff
468 --in-reply-to=
469 --full-index --binary
470 " -- "$cur"))
471 return
473 esac
474 __git_complete_revlist
477 _git_ls_remote ()
479 local cur="${COMP_WORDS[COMP_CWORD]}"
480 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
483 _git_ls_tree ()
485 __git_complete_file
488 _git_log ()
490 local cur="${COMP_WORDS[COMP_CWORD]}"
491 case "$cur" in
492 --pretty=*)
493 COMPREPLY=($(compgen -W "
494 oneline short medium full fuller email raw
495 " -- "${cur##--pretty=}"))
496 return
498 --*)
499 COMPREPLY=($(compgen -W "
500 --max-count= --max-age= --since= --after=
501 --min-age= --before= --until=
502 --root --not --topo-order --date-order
503 --no-merges
504 --abbrev-commit --abbrev=
505 --relative-date
506 --author= --committer= --grep=
507 --all-match
508 --pretty= --name-status --name-only
509 " -- "$cur"))
510 return
512 esac
513 __git_complete_revlist
516 _git_merge ()
518 local cur="${COMP_WORDS[COMP_CWORD]}"
519 case "${COMP_WORDS[COMP_CWORD-1]}" in
520 -s|--strategy)
521 COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
522 return
523 esac
524 case "$cur" in
525 --strategy=*)
526 COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
527 -- "${cur##--strategy=}"))
528 return
530 --*)
531 COMPREPLY=($(compgen -W "
532 --no-commit --no-summary --squash --strategy
533 " -- "$cur"))
534 return
535 esac
536 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
539 _git_merge_base ()
541 local cur="${COMP_WORDS[COMP_CWORD]}"
542 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
545 _git_name_rev ()
547 local cur="${COMP_WORDS[COMP_CWORD]}"
548 COMPREPLY=($(compgen -W "--tags --all --stdin" -- "$cur"))
551 _git_pull ()
553 local cur="${COMP_WORDS[COMP_CWORD]}"
555 case "${COMP_WORDS[0]},$COMP_CWORD" in
556 git-pull*,1)
557 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
559 git,2)
560 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
563 local remote
564 case "${COMP_WORDS[0]}" in
565 git-pull) remote="${COMP_WORDS[1]}" ;;
566 git) remote="${COMP_WORDS[2]}" ;;
567 esac
568 COMPREPLY=($(compgen -W "$(__git_refs "$remote")" -- "$cur"))
570 esac
573 _git_push ()
575 local cur="${COMP_WORDS[COMP_CWORD]}"
577 case "${COMP_WORDS[0]},$COMP_CWORD" in
578 git-push*,1)
579 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
581 git,2)
582 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
585 case "$cur" in
586 *:*)
587 local remote
588 case "${COMP_WORDS[0]}" in
589 git-push) remote="${COMP_WORDS[1]}" ;;
590 git) remote="${COMP_WORDS[2]}" ;;
591 esac
592 cur="${cur#*:}"
593 COMPREPLY=($(compgen -W "$(__git_refs "$remote")" -- "$cur"))
596 COMPREPLY=($(compgen -W "$(__git_refs2)" -- "$cur"))
598 esac
600 esac
603 _git_rebase ()
605 local cur="${COMP_WORDS[COMP_CWORD]}"
606 if [ -d .dotest ]; then
607 COMPREPLY=($(compgen -W "
608 --continue --skip --abort
609 " -- "$cur"))
610 return
612 case "${COMP_WORDS[COMP_CWORD-1]}" in
613 -s|--strategy)
614 COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
615 return
616 esac
617 case "$cur" in
618 --strategy=*)
619 COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
620 -- "${cur##--strategy=}"))
621 return
623 --*)
624 COMPREPLY=($(compgen -W "
625 --onto --merge --strategy
626 " -- "$cur"))
627 return
628 esac
629 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
632 _git_repo_config ()
634 local cur="${COMP_WORDS[COMP_CWORD]}"
635 local prv="${COMP_WORDS[COMP_CWORD-1]}"
636 case "$prv" in
637 branch.*.remote)
638 COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
639 return
641 branch.*.merge)
642 COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
643 return
645 remote.*.fetch)
646 local remote="${prv#remote.}"
647 remote="${remote%.fetch}"
648 COMPREPLY=($(compgen -W "$(__git_refs_remotes "$remote")" \
649 -- "$cur"))
650 return
652 remote.*.push)
653 local remote="${prv#remote.}"
654 remote="${remote%.push}"
655 COMPREPLY=($(compgen -W "$(git --git-dir="$(__gitdir)" \
656 for-each-ref --format='%(refname):%(refname)' \
657 refs/heads)" -- "$cur"))
658 return
660 *.*)
661 COMPREPLY=()
662 return
664 esac
665 case "$cur" in
666 --*)
667 COMPREPLY=($(compgen -W "
668 --global --list --replace-all
669 --get --get-all --get-regexp
670 --unset --unset-all
671 " -- "$cur"))
672 return
674 branch.*.*)
675 local pfx="${cur%.*}."
676 cur="${cur##*.}"
677 COMPREPLY=($(compgen -P "$pfx" -W "remote merge" -- "$cur"))
678 return
680 branch.*)
681 local pfx="${cur%.*}."
682 cur="${cur#*.}"
683 COMPREPLY=($(compgen -P "$pfx" -S . \
684 -W "$(__git_heads)" -- "$cur"))
685 return
687 remote.*.*)
688 local pfx="${cur%.*}."
689 cur="${cur##*.}"
690 COMPREPLY=($(compgen -P "$pfx" -W "url fetch push" -- "$cur"))
691 return
693 remote.*)
694 local pfx="${cur%.*}."
695 cur="${cur#*.}"
696 COMPREPLY=($(compgen -P "$pfx" -S . \
697 -W "$(__git_remotes)" -- "$cur"))
698 return
700 esac
701 COMPREPLY=($(compgen -W "
702 apply.whitespace
703 core.fileMode
704 core.gitProxy
705 core.ignoreStat
706 core.preferSymlinkRefs
707 core.logAllRefUpdates
708 core.repositoryFormatVersion
709 core.sharedRepository
710 core.warnAmbiguousRefs
711 core.compression
712 core.legacyHeaders
713 i18n.commitEncoding
714 diff.color
715 color.diff
716 diff.renameLimit
717 diff.renames
718 pager.color
719 color.pager
720 status.color
721 color.status
722 log.showroot
723 show.difftree
724 showbranch.default
725 whatchanged.difftree
726 http.sslVerify
727 http.sslCert
728 http.sslKey
729 http.sslCAInfo
730 http.sslCAPath
731 http.maxRequests
732 http.lowSpeedLimit http.lowSpeedTime
733 http.noEPSV
734 pack.window
735 repack.useDeltaBaseOffset
736 pull.octopus pull.twohead
737 merge.summary
738 receive.unpackLimit
739 receive.denyNonFastForwards
740 user.name user.email
741 tar.umask
742 gitcvs.enabled
743 gitcvs.logfile
744 branch. remote.
745 " -- "$cur"))
748 _git_reset ()
750 local cur="${COMP_WORDS[COMP_CWORD]}"
751 local opt="--mixed --hard --soft"
752 COMPREPLY=($(compgen -W "$opt $(__git_refs)" -- "$cur"))
755 _git_show ()
757 local cur="${COMP_WORDS[COMP_CWORD]}"
758 case "$cur" in
759 --pretty=*)
760 COMPREPLY=($(compgen -W "
761 oneline short medium full fuller email raw
762 " -- "${cur##--pretty=}"))
763 return
765 --*)
766 COMPREPLY=($(compgen -W "--pretty=" -- "$cur"))
767 return
769 esac
770 __git_complete_file
773 _git ()
775 local i c=1 command __git_dir
777 while [ $c -lt $COMP_CWORD ]; do
778 i="${COMP_WORDS[c]}"
779 case "$i" in
780 --git-dir=*) __git_dir="${i#--git-dir=}" ;;
781 --bare) __git_dir="." ;;
782 --version|--help|-p|--paginate) ;;
783 *) command="$i"; break ;;
784 esac
785 c=$((++c))
786 done
788 if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
789 COMPREPLY=($(compgen -W "
790 --git-dir= --version --exec-path
791 $(__git_commands)
792 $(__git_aliases)
793 " -- "${COMP_WORDS[COMP_CWORD]}"))
794 return;
797 local expansion=$(__git_aliased_command "$command")
798 [ "$expansion" ] && command="$expansion"
800 case "$command" in
801 am) _git_am ;;
802 apply) _git_apply ;;
803 branch) _git_branch ;;
804 cat-file) _git_cat_file ;;
805 checkout) _git_checkout ;;
806 cherry-pick) _git_cherry_pick ;;
807 commit) _git_commit ;;
808 diff) _git_diff ;;
809 diff-tree) _git_diff_tree ;;
810 fetch) _git_fetch ;;
811 format-patch) _git_format_patch ;;
812 log) _git_log ;;
813 ls-remote) _git_ls_remote ;;
814 ls-tree) _git_ls_tree ;;
815 merge) _git_merge;;
816 merge-base) _git_merge_base ;;
817 name-rev) _git_name_rev ;;
818 pull) _git_pull ;;
819 push) _git_push ;;
820 rebase) _git_rebase ;;
821 repo-config) _git_repo_config ;;
822 reset) _git_reset ;;
823 show) _git_show ;;
824 show-branch) _git_log ;;
825 whatchanged) _git_log ;;
826 *) COMPREPLY=() ;;
827 esac
830 _gitk ()
832 local cur="${COMP_WORDS[COMP_CWORD]}"
833 COMPREPLY=($(compgen -W "--all $(__git_refs)" -- "$cur"))
836 complete -o default -o nospace -F _git git
837 complete -o default -F _gitk gitk
838 complete -o default -F _git_am git-am
839 complete -o default -F _git_apply git-apply
840 complete -o default -F _git_branch git-branch
841 complete -o default -o nospace -F _git_cat_file git-cat-file
842 complete -o default -F _git_checkout git-checkout
843 complete -o default -F _git_cherry_pick git-cherry-pick
844 complete -o default -F _git_commit git-commit
845 complete -o default -o nospace -F _git_diff git-diff
846 complete -o default -F _git_diff_tree git-diff-tree
847 complete -o default -o nospace -F _git_fetch git-fetch
848 complete -o default -o nospace -F _git_format_patch git-format-patch
849 complete -o default -o nospace -F _git_log git-log
850 complete -o default -F _git_ls_remote git-ls-remote
851 complete -o default -o nospace -F _git_ls_tree git-ls-tree
852 complete -o default -F _git_merge git-merge
853 complete -o default -F _git_merge_base git-merge-base
854 complete -o default -F _git_name_rev git-name-rev
855 complete -o default -o nospace -F _git_pull git-pull
856 complete -o default -o nospace -F _git_push git-push
857 complete -o default -F _git_rebase git-rebase
858 complete -o default -F _git_repo_config git-repo-config
859 complete -o default -F _git_reset git-reset
860 complete -o default -o nospace -F _git_show git-show
861 complete -o default -o nospace -F _git_log git-show-branch
862 complete -o default -o nospace -F _git_log git-whatchanged
864 # The following are necessary only for Cygwin, and only are needed
865 # when the user has tab-completed the executable name and consequently
866 # included the '.exe' suffix.
868 if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
869 complete -o default -F _git_apply git-apply.exe
870 complete -o default -o nospace -F _git git.exe
871 complete -o default -F _git_branch git-branch.exe
872 complete -o default -o nospace -F _git_cat_file git-cat-file.exe
873 complete -o default -o nospace -F _git_diff git-diff.exe
874 complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe
875 complete -o default -o nospace -F _git_format_patch git-format-patch.exe
876 complete -o default -o nospace -F _git_log git-log.exe
877 complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
878 complete -o default -F _git_merge_base git-merge-base.exe
879 complete -o default -F _git_name_rev git-name-rev.exe
880 complete -o default -o nospace -F _git_push git-push.exe
881 complete -o default -F _git_repo_config git-repo-config
882 complete -o default -o nospace -F _git_show git-show.exe
883 complete -o default -o nospace -F _git_log git-show-branch.exe
884 complete -o default -o nospace -F _git_log git-whatchanged.exe