3 # bash/zsh 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 # *) file paths within current working directory and index
17 # *) common --long-options
19 # To use these routines:
21 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
22 # 2) Add the following line to your .bashrc/.zshrc:
23 # source ~/.git-completion.sh
24 # 3) Consider changing your PS1 to also show the current branch,
25 # see git-prompt.sh for details.
27 case "$COMP_WORDBREAKS" in
29 *) COMP_WORDBREAKS
="$COMP_WORDBREAKS:"
32 # __gitdir accepts 0 or 1 arguments (i.e., location)
33 # returns location of .git repo
36 # Note: this function is duplicated in git-prompt.sh
37 # When updating it, make sure you update the other one to match.
38 if [ -z "${1-}" ]; then
39 if [ -n "${__git_dir-}" ]; then
41 elif [ -n "${GIT_DIR-}" ]; then
42 test -d "${GIT_DIR-}" ||
return 1
44 elif [ -d .git
]; then
47 git rev-parse
--git-dir 2>/dev
/null
49 elif [ -d "$1/.git" ]; then
56 # The following function is based on code from:
58 # bash_completion - programmable completion functions for bash 3.2+
60 # Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
61 # © 2009-2010, Bash Completion Maintainers
62 # <bash-completion-devel@lists.alioth.debian.org>
64 # This program is free software; you can redistribute it and/or modify
65 # it under the terms of the GNU General Public License as published by
66 # the Free Software Foundation; either version 2, or (at your option)
69 # This program is distributed in the hope that it will be useful,
70 # but WITHOUT ANY WARRANTY; without even the implied warranty of
71 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72 # GNU General Public License for more details.
74 # You should have received a copy of the GNU General Public License
75 # along with this program; if not, write to the Free Software Foundation,
76 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
78 # The latest version of this software can be obtained here:
80 # http://bash-completion.alioth.debian.org/
84 # This function can be used to access a tokenized list of words
85 # on the command line:
87 # __git_reassemble_comp_words_by_ref '=:'
88 # if test "${words_[cword_-1]}" = -w
93 # The argument should be a collection of characters from the list of
94 # word completion separators (COMP_WORDBREAKS) to treat as ordinary
97 # This is roughly equivalent to going back in time and setting
98 # COMP_WORDBREAKS to exclude those characters. The intent is to
99 # make option types like --date=<type> and <rev>:<path> easy to
100 # recognize by treating each shell word as a single token.
102 # It is best not to set COMP_WORDBREAKS directly because the value is
103 # shared with other completion scripts. By the time the completion
104 # function gets called, COMP_WORDS has already been populated so local
105 # changes to COMP_WORDBREAKS have no effect.
107 # Output: words_, cword_, cur_.
109 __git_reassemble_comp_words_by_ref
()
111 local exclude i j first
112 # Which word separators to exclude?
113 exclude
="${1//[^$COMP_WORDBREAKS]}"
115 if [ -z "$exclude" ]; then
116 words_
=("${COMP_WORDS[@]}")
119 # List of word completion separators has shrunk;
120 # re-assemble words to complete.
121 for ((i
=0, j
=0; i
< ${#COMP_WORDS[@]}; i
++, j
++)); do
122 # Append each nonempty word consisting of just
123 # word separator characters to the current word.
127 [ -n "${COMP_WORDS[$i]}" ] &&
128 # word consists of excluded word separators
129 [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ]
131 # Attach to the previous token,
132 # unless the previous token is the command name.
133 if [ $j -ge 2 ] && [ -n "$first" ]; then
137 words_
[$j]=${words_[j]}${COMP_WORDS[i]}
138 if [ $i = $COMP_CWORD ]; then
141 if (($i < ${#COMP_WORDS[@]} - 1)); then
148 words_
[$j]=${words_[j]}${COMP_WORDS[i]}
149 if [ $i = $COMP_CWORD ]; then
155 if ! type _get_comp_words_by_ref
>/dev
/null
2>&1; then
156 _get_comp_words_by_ref
()
158 local exclude cur_ words_ cword_
159 if [ "$1" = "-n" ]; then
163 __git_reassemble_comp_words_by_ref
"$exclude"
164 cur_
=${words_[cword_]}
165 while [ $# -gt 0 ]; do
171 prev
=${words_[$cword_-1]}
174 words
=("${words_[@]}")
189 if [[ "$x" == "$3"* ]]; then
190 COMPREPLY
[i
++]="$2$x$4"
195 # Generates completion reply, appending a space to possible completion words,
197 # It accepts 1 to 4 arguments:
198 # 1: List of possible completion words.
199 # 2: A prefix to be added to each possible completion word (optional).
200 # 3: Generate possible completion matches for this word (optional).
201 # 4: A suffix to be appended to each possible completion word (optional).
204 local cur_
="${3-$cur}"
210 local c i
=0 IFS
=$
' \t\n'
213 if [[ $c == "$cur_"* ]]; then
218 COMPREPLY
[i
++]="${2-}$c"
225 # Generates completion reply from newline-separated possible completion words
226 # by appending a space to all of them.
227 # It accepts 1 to 4 arguments:
228 # 1: List of possible completion words, separated by a single newline.
229 # 2: A prefix to be added to each possible completion word (optional).
230 # 3: Generate possible completion matches for this word (optional).
231 # 4: A suffix to be appended to each possible completion word instead of
232 # the default space (optional). If specified but empty, nothing is
237 __gitcompadd
"$1" "${2-}" "${3-$cur}" "${4- }"
240 # Generates completion reply with compgen from newline-separated possible
241 # completion filenames.
242 # It accepts 1 to 3 arguments:
243 # 1: List of possible completion filenames, separated by a single newline.
244 # 2: A directory prefix to be added to each possible completion filename
246 # 3: Generate possible completion matches for this word (optional).
251 # XXX does not work when the directory prefix contains a tilde,
252 # since tilde expansion is not applied.
253 # This means that COMPREPLY will be empty and Bash default
254 # completion will be used.
255 COMPREPLY
=($
(compgen
-P "${2-}" -W "$1" -- "${3-$cur}"))
257 # Tell Bash that compspec generates filenames.
258 compopt
-o filenames
2>/dev
/null
261 __git_index_file_list_filter_compat
()
265 while read -r path
; do
267 ?
*/*) echo "${path%%/*}/" ;;
273 __git_index_file_list_filter_bash
()
277 while read -r path
; do
280 # XXX if we append a slash to directory names when using
281 # `compopt -o filenames`, Bash will append another slash.
282 # This is pretty stupid, and this the reason why we have to
283 # define a compatible version for this function.
284 echo "${path%%/*}" ;;
291 # Process path list returned by "ls-files" and "diff-index --name-only"
292 # commands, in order to list only file names relative to a specified
293 # directory, and append a slash to directory names.
294 __git_index_file_list_filter
()
296 # Default to Bash >= 4.x
297 __git_index_file_list_filter_bash
300 # Execute git ls-files, returning paths relative to the directory
301 # specified in the first argument, and using the options specified in
302 # the second argument.
303 __git_ls_files_helper
()
306 test -n "${CDPATH+set}" && unset CDPATH
307 # NOTE: $2 is not quoted in order to support multiple options
308 cd "$1" && git ls-files
--exclude-standard $2
313 # Execute git diff-index, returning paths relative to the directory
314 # specified in the first argument, and using the tree object id
315 # specified in the second argument.
316 __git_diff_index_helper
()
319 test -n "${CDPATH+set}" && unset CDPATH
320 cd "$1" && git diff-index
--name-only --relative "$2"
324 # __git_index_files accepts 1 or 2 arguments:
325 # 1: Options to pass to ls-files (required).
326 # Supported options are --cached, --modified, --deleted, --others,
328 # 2: A directory path (optional).
329 # If provided, only files within the specified directory are listed.
330 # Sub directories are never recursed. Path must have a trailing
334 local dir
="$(__gitdir)" root
="${2-.}"
336 if [ -d "$dir" ]; then
337 __git_ls_files_helper
"$root" "$1" | __git_index_file_list_filter |
342 # __git_diff_index_files accepts 1 or 2 arguments:
343 # 1) The id of a tree object.
344 # 2) A directory path (optional).
345 # If provided, only files within the specified directory are listed.
346 # Sub directories are never recursed. Path must have a trailing
348 __git_diff_index_files
()
350 local dir
="$(__gitdir)" root
="${2-.}"
352 if [ -d "$dir" ]; then
353 __git_diff_index_helper
"$root" "$1" | __git_index_file_list_filter |
360 local dir
="$(__gitdir)"
361 if [ -d "$dir" ]; then
362 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
370 local dir
="$(__gitdir)"
371 if [ -d "$dir" ]; then
372 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
378 # __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments
379 # presence of 2nd argument means use the guess heuristic employed
380 # by checkout for tracking branches
383 local i
hash dir
="$(__gitdir "${1-}")" track
="${2-}"
385 if [ -d "$dir" ]; then
393 for i
in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD
; do
394 if [ -e "$dir/$i" ]; then echo $i; fi
396 format
="refname:short"
397 refs
="refs/tags refs/heads refs/remotes"
400 git
--git-dir="$dir" for-each-ref
--format="%($format)" \
402 if [ -n "$track" ]; then
403 # employ the heuristic used by git checkout
404 # Try to find a remote branch that matches the completion word
405 # but only output if the branch name is unique
407 git
--git-dir="$dir" for-each-ref
--shell --format="ref=%(refname:short)" \
409 while read -r entry
; do
412 if [[ "$ref" == "$cur"* ]]; then
415 done |
sort |
uniq -u
421 git ls-remote
"$dir" "$cur*" 2>/dev
/null | \
422 while read -r hash i
; do
430 git ls-remote
"$dir" HEAD ORIG_HEAD
'refs/tags/*' 'refs/heads/*' 'refs/remotes/*' 2>/dev
/null | \
431 while read -r hash i
; do
434 refs
/*) echo "${i#refs/*/}" ;;
442 # __git_refs2 requires 1 argument (to pass to __git_refs)
446 for i
in $
(__git_refs
"$1"); do
451 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
452 __git_refs_remotes
()
455 git ls-remote
"$1" 'refs/heads/*' 2>/dev
/null | \
456 while read -r hash i
; do
457 echo "$i:refs/remotes/$1/${i#refs/heads/}"
463 local i IFS
=$
'\n' d
="$(__gitdir)"
464 test -d "$d/remotes" && ls -1 "$d/remotes"
465 for i
in $
(git
--git-dir="$d" config
--get-regexp 'remote\..*\.url' 2>/dev
/null
); do
471 __git_list_merge_strategies
()
473 git merge
-s help 2>&1 |
474 sed -n -e '/[Aa]vailable strategies are: /,/^$/{
483 __git_merge_strategies
=
484 # 'git merge -s help' (and thus detection of the merge strategy
485 # list) fails, unfortunately, if run outside of any git working
486 # tree. __git_merge_strategies is set to the empty string in
487 # that case, and the detection will be repeated the next time it
489 __git_compute_merge_strategies
()
491 test -n "$__git_merge_strategies" ||
492 __git_merge_strategies
=$
(__git_list_merge_strategies
)
495 __git_complete_revlist_file
()
497 local pfx
ls ref cur_
="$cur"
517 case "$COMP_WORDBREAKS" in
519 *) pfx
="$ref:$pfx" ;;
522 __gitcomp_nl
"$(git --git-dir="$
(__gitdir
)" ls-tree "$ls" 2>/dev/null \
523 | sed '/^100... blob /{
539 pfx
="${cur_%...*}..."
541 __gitcomp_nl
"$(__git_refs)" "$pfx" "$cur_"
546 __gitcomp_nl
"$(__git_refs)" "$pfx" "$cur_"
549 __gitcomp_nl
"$(__git_refs)"
555 # __git_complete_index_file requires 1 argument: the options to pass to
557 __git_complete_index_file
()
559 local pfx cur_
="$cur"
567 __gitcomp_file
"$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
570 __gitcomp_file
"$(__git_index_files "$1")" "" "$cur_"
575 # __git_complete_diff_index_file requires 1 argument: the id of a tree
577 __git_complete_diff_index_file
()
579 local pfx cur_
="$cur"
587 __gitcomp_file
"$(__git_diff_index_files "$1" "$pfx")" "$pfx" "$cur_"
590 __gitcomp_file
"$(__git_diff_index_files "$1")" "" "$cur_"
595 __git_complete_file
()
597 __git_complete_revlist_file
600 __git_complete_revlist
()
602 __git_complete_revlist_file
605 __git_complete_remote_or_refspec
()
607 local cur_
="$cur" cmd
="${words[1]}"
608 local i c
=2 remote
="" pfx
="" lhs
=1 no_complete_refspec
=0
609 if [ "$cmd" = "remote" ]; then
612 while [ $c -lt $cword ]; do
615 --mirror) [ "$cmd" = "push" ] && no_complete_refspec
=1 ;;
618 push
) no_complete_refspec
=1 ;;
626 *) remote
="$i"; break ;;
630 if [ -z "$remote" ]; then
631 __gitcomp_nl
"$(__git_remotes)"
634 if [ $no_complete_refspec = 1 ]; then
637 [ "$remote" = "." ] && remote
=
640 case "$COMP_WORDBREAKS" in
642 *) pfx
="${cur_%%:*}:" ;;
654 if [ $lhs = 1 ]; then
655 __gitcomp_nl
"$(__git_refs2 "$remote")" "$pfx" "$cur_"
657 __gitcomp_nl
"$(__git_refs)" "$pfx" "$cur_"
661 if [ $lhs = 1 ]; then
662 __gitcomp_nl
"$(__git_refs "$remote")" "$pfx" "$cur_"
664 __gitcomp_nl
"$(__git_refs)" "$pfx" "$cur_"
668 if [ $lhs = 1 ]; then
669 __gitcomp_nl
"$(__git_refs)" "$pfx" "$cur_"
671 __gitcomp_nl
"$(__git_refs "$remote")" "$pfx" "$cur_"
677 __git_complete_strategy
()
679 __git_compute_merge_strategies
682 __gitcomp
"$__git_merge_strategies"
687 __gitcomp
"$__git_merge_strategies" "" "${cur##--strategy=}"
695 if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"
697 printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
699 git
help -a|
egrep '^ [a-zA-Z0-9]'
703 __git_list_all_commands
()
706 for i
in $
(__git_commands
)
709 *--*) : helper pattern
;;
716 __git_compute_all_commands
()
718 test -n "$__git_all_commands" ||
719 __git_all_commands
=$
(__git_list_all_commands
)
722 __git_list_porcelain_commands
()
725 __git_compute_all_commands
726 for i
in $__git_all_commands
729 *--*) : helper pattern
;;
730 applymbox
) : ask gittus
;;
731 applypatch
) : ask gittus
;;
732 archimport
) : import
;;
733 cat-file
) : plumbing
;;
734 check-attr
) : plumbing
;;
735 check-ignore
) : plumbing
;;
736 check-ref-format
) : plumbing
;;
737 checkout-index
) : plumbing
;;
738 commit-tree
) : plumbing
;;
739 count-objects
) : infrequent
;;
740 credential-cache
) : credentials helper
;;
741 credential-store
) : credentials helper
;;
742 cvsexportcommit
) : export;;
743 cvsimport
) : import
;;
744 cvsserver
) : daemon
;;
746 diff-files
) : plumbing
;;
747 diff-index
) : plumbing
;;
748 diff-tree
) : plumbing
;;
749 fast-import
) : import
;;
750 fast-export
) : export;;
751 fsck-objects
) : plumbing
;;
752 fetch-pack
) : plumbing
;;
753 fmt-merge-msg
) : plumbing
;;
754 for-each-ref
) : plumbing
;;
755 hash-object
) : plumbing
;;
756 http-
*) : transport
;;
757 index-pack
) : plumbing
;;
758 init-db
) : deprecated
;;
759 local-fetch
) : plumbing
;;
760 lost-found
) : infrequent
;;
761 ls-files
) : plumbing
;;
762 ls-remote
) : plumbing
;;
763 ls-tree
) : plumbing
;;
764 mailinfo
) : plumbing
;;
765 mailsplit
) : plumbing
;;
766 merge-
*) : plumbing
;;
769 pack-objects
) : plumbing
;;
770 pack-redundant
) : plumbing
;;
771 pack-refs
) : plumbing
;;
772 parse-remote
) : plumbing
;;
773 patch-id
) : plumbing
;;
774 peek-remote
) : plumbing
;;
776 prune-packed
) : plumbing
;;
777 quiltimport
) : import
;;
778 read-tree
) : plumbing
;;
779 receive-pack
) : plumbing
;;
780 remote-
*) : transport
;;
781 repo-config
) : deprecated
;;
783 rev-list
) : plumbing
;;
784 rev-parse
) : plumbing
;;
785 runstatus
) : plumbing
;;
786 sh-setup
) : internal
;;
788 show-ref
) : plumbing
;;
789 send-pack
) : plumbing
;;
790 show-index
) : plumbing
;;
792 stripspace
) : plumbing
;;
793 symbolic-ref
) : plumbing
;;
794 tar-tree
) : deprecated
;;
795 unpack-file
) : plumbing
;;
796 unpack-objects
) : plumbing
;;
797 update-index
) : plumbing
;;
798 update-ref
) : plumbing
;;
799 update-server-info
) : daemon
;;
800 upload-archive
) : plumbing
;;
801 upload-pack
) : plumbing
;;
802 write-tree
) : plumbing
;;
804 verify-pack
) : infrequent
;;
805 verify-tag
) : plumbing
;;
811 __git_porcelain_commands
=
812 __git_compute_porcelain_commands
()
814 __git_compute_all_commands
815 test -n "$__git_porcelain_commands" ||
816 __git_porcelain_commands
=$
(__git_list_porcelain_commands
)
819 __git_pretty_aliases
()
822 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "pretty\..*" 2>/dev
/null
); do
835 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "alias\..*" 2>/dev
/null
); do
845 # __git_aliased_command requires 1 argument
846 __git_aliased_command
()
848 local word cmdline
=$
(git
--git-dir="$(__gitdir)" \
849 config
--get "alias.$1")
850 for word
in $cmdline; do
856 \
!*) : shell
command alias ;;
858 *=*) : setting env
;;
867 # __git_find_on_cmdline requires 1 argument
868 __git_find_on_cmdline
()
870 local word subcommand c
=1
871 while [ $c -lt $cword ]; do
873 for subcommand
in $1; do
874 if [ "$subcommand" = "$word" ]; then
883 __git_has_doubledash
()
886 while [ $c -lt $cword ]; do
887 if [ "--" = "${words[c]}" ]; then
895 # Try to count non option arguments passed on the command line for the
896 # specified git command.
897 # When options are used, it is necessary to use the special -- option to
898 # tell the implementation were non option arguments begin.
899 # XXX this can not be improved, since options can appear everywhere, as
903 # __git_count_arguments requires 1 argument: the git command executed.
904 __git_count_arguments
()
908 # Skip "git" (first argument)
909 for ((i
=1; i
< ${#words[@]}; i
++)); do
914 # Good; we can assume that the following are only non
919 # Skip the specified git command and discard git
932 __git_whitespacelist
="nowarn warn error error-all fix"
936 local dir
="$(__gitdir)"
937 if [ -d "$dir"/rebase-apply
]; then
938 __gitcomp
"--skip --continue --resolved --abort"
943 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
948 --3way --committer-date-is-author-date --ignore-date
949 --ignore-whitespace --ignore-space-change
950 --interactive --keep --no-utf8 --signoff --utf8
951 --whitespace= --scissors
961 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
966 --stat --numstat --summary --check --index
967 --cached --index-info --reverse --reject --unidiff-zero
968 --apply --no-add --exclude=
969 --ignore-whitespace --ignore-space-change
970 --whitespace= --inaccurate-eof --verbose
981 --interactive --refresh --patch --update --dry-run
982 --ignore-errors --intent-to-add
987 # XXX should we check for --update and --all options ?
988 __git_complete_index_file
"--others --modified"
995 __gitcomp
"$(git archive --list)" "" "${cur##--format=}"
999 __gitcomp_nl
"$(__git_remotes)" "" "${cur##--remote=}"
1004 --format= --list --verbose
1005 --prefix= --remote= --exec=
1015 __git_has_doubledash
&& return
1017 local subcommands
="start bad good skip reset visualize replay log run"
1018 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
1019 if [ -z "$subcommand" ]; then
1020 if [ -f "$(__gitdir)"/BISECT_START
]; then
1021 __gitcomp
"$subcommands"
1023 __gitcomp
"replay start"
1028 case "$subcommand" in
1029 bad|good|
reset|skip|start
)
1030 __gitcomp_nl
"$(__git_refs)"
1039 local i c
=1 only_local_ref
="n" has_r
="n"
1041 while [ $c -lt $cword ]; do
1044 -d|
-m) only_local_ref
="y" ;;
1051 --set-upstream-to=*)
1052 __gitcomp
"$(__git_refs)" "" "${cur##--set-upstream-to=}"
1056 --color --no-color --verbose --abbrev= --no-abbrev
1057 --track --no-track --contains --merged --no-merged
1058 --set-upstream-to= --edit-description --list
1063 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
1064 __gitcomp_nl
"$(__git_heads)"
1066 __gitcomp_nl
"$(__git_refs)"
1074 local cmd
="${words[2]}"
1077 __gitcomp
"create list-heads verify unbundle"
1080 # looking for a file
1085 __git_complete_revlist
1094 __git_has_doubledash
&& return
1098 __gitcomp
"diff3 merge" "" "${cur##--conflict=}"
1102 --quiet --ours --theirs --track --no-track --merge
1103 --conflict= --orphan --patch
1107 # check if --track, --no-track, or --no-guess was specified
1108 # if so, disable DWIM mode
1109 local flags
="--track --no-track --no-guess" track
=1
1110 if [ -n "$(__git_find_on_cmdline "$flags")" ]; then
1113 __gitcomp_nl
"$(__git_refs '' $track)"
1120 __gitcomp
"$(__git_refs)"
1125 local dir
="$(__gitdir)"
1126 if [ -f "$dir"/CHERRY_PICK_HEAD
]; then
1127 __gitcomp
"--continue --quit --abort"
1132 __gitcomp
"--edit --no-commit --signoff --strategy= --mainline"
1135 __gitcomp_nl
"$(__git_refs)"
1144 __gitcomp
"--dry-run --quiet"
1149 # XXX should we check for -x option ?
1150 __git_complete_index_file
"--others"
1182 __gitcomp_nl
"$(__git_refs)" "" "${cur}"
1189 __gitcomp
"default strip verbatim whitespace
1190 " "" "${cur##--cleanup=}"
1193 --reuse-message=*|
--reedit-message=*|\
1194 --fixup=*|
--squash=*)
1195 __gitcomp_nl
"$(__git_refs)" "" "${cur#*=}"
1198 --untracked-files=*)
1199 __gitcomp
"all no normal" "" "${cur##--untracked-files=}"
1204 --all --author= --signoff --verify --no-verify
1206 --amend --include --only --interactive
1207 --dry-run --reuse-message= --reedit-message=
1208 --reset-author --file= --message= --template=
1209 --cleanup= --untracked-files --untracked-files=
1210 --verbose --quiet --fixup= --squash=
1215 if git rev-parse
--verify --quiet HEAD
>/dev
/null
; then
1216 __git_complete_diff_index_file
"HEAD"
1218 # This is the first commit
1219 __git_complete_index_file
"--cached"
1228 --all --tags --contains --abbrev= --candidates=
1229 --exact-match --debug --long --match --always
1233 __gitcomp_nl
"$(__git_refs)"
1236 __git_diff_algorithms
="myers minimal patience histogram"
1238 __git_diff_common_options
="--stat --numstat --shortstat --summary
1239 --patch-with-stat --name-only --name-status --color
1240 --no-color --color-words --no-renames --check
1241 --full-index --binary --abbrev --diff-filter=
1242 --find-copies-harder
1243 --text --ignore-space-at-eol --ignore-space-change
1244 --ignore-all-space --exit-code --quiet --ext-diff
1246 --no-prefix --src-prefix= --dst-prefix=
1247 --inter-hunk-context=
1248 --patience --histogram --minimal
1250 --dirstat --dirstat= --dirstat-by-file
1251 --dirstat-by-file= --cumulative
1257 __git_has_doubledash
&& return
1261 __gitcomp
"$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
1265 __gitcomp
"--cached --staged --pickaxe-all --pickaxe-regex
1266 --base --ours --theirs --no-index
1267 $__git_diff_common_options
1272 __git_complete_revlist_file
1275 __git_mergetools_common
="diffuse ecmerge emerge kdiff3 meld opendiff
1276 tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
1281 __git_has_doubledash
&& return
1285 __gitcomp
"$__git_mergetools_common kompare" "" "${cur##--tool=}"
1289 __gitcomp
"--cached --staged --pickaxe-all --pickaxe-regex
1290 --base --ours --theirs
1291 --no-renames --diff-filter= --find-copies-harder
1292 --relative --ignore-submodules
1300 __git_fetch_options
="
1301 --quiet --verbose --append --upload-pack --force --keep --depth=
1302 --tags --no-tags --all --prune --dry-run
1309 __gitcomp
"$__git_fetch_options"
1313 __git_complete_remote_or_refspec
1316 __git_format_patch_options
="
1317 --stdout --attach --no-attach --thread --thread= --no-thread
1318 --numbered --start-number --numbered-files --keep-subject --signoff
1319 --signature --no-signature --in-reply-to= --cc= --full-index --binary
1320 --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
1321 --inline --suffix= --ignore-if-in-upstream --subject-prefix=
1322 --output-directory --reroll-count --to= --quiet --notes
1325 _git_format_patch
()
1331 " "" "${cur##--thread=}"
1335 __gitcomp
"$__git_format_patch_options"
1339 __git_complete_revlist
1347 --tags --root --unreachable --cache --no-reflogs --full
1348 --strict --verbose --lost-found
1359 __gitcomp
"--prune --aggressive"
1370 __git_match_ctag
() {
1371 awk "/^${1////\\/}/ { print \$1 }" "$2"
1376 __git_has_doubledash
&& return
1382 --text --ignore-case --word-regexp --invert-match
1383 --full-name --line-number
1384 --extended-regexp --basic-regexp --fixed-strings
1386 --files-with-matches --name-only
1387 --files-without-match
1390 --and --or --not --all-match
1396 case "$cword,$prev" in
1398 if test -r tags
; then
1399 __gitcomp_nl
"$(__git_match_ctag "$cur" tags)"
1405 __gitcomp_nl
"$(__git_refs)"
1412 __gitcomp
"--all --info --man --web"
1416 __git_compute_all_commands
1417 __gitcomp
"$__git_all_commands $(__git_aliases)
1418 attributes cli core-tutorial cvs-migration
1419 diffcore gitk glossary hooks ignore modules
1420 namespaces repository-layout tutorial tutorial-2
1430 false true umask group all world everybody
1431 " "" "${cur##--shared=}"
1435 __gitcomp
"--quiet --bare --template= --shared --shared="
1445 __gitcomp
"--cached --deleted --modified --others --ignored
1446 --stage --directory --no-empty-directory --unmerged
1447 --killed --exclude= --exclude-from=
1448 --exclude-per-directory= --exclude-standard
1449 --error-unmatch --with-tree= --full-name
1450 --abbrev --ignored --exclude-per-directory
1456 # XXX ignore options like --modified and always suggest all cached
1458 __git_complete_index_file
"--cached"
1463 __gitcomp_nl
"$(__git_remotes)"
1471 # Options that go well for log, shortlog and gitk
1472 __git_log_common_options
="
1474 --branches --tags --remotes
1475 --first-parent --merges --no-merges
1477 --max-age= --since= --after=
1478 --min-age= --until= --before=
1479 --min-parents= --max-parents=
1480 --no-min-parents --no-max-parents
1482 # Options that go well for log and gitk (not shortlog)
1483 __git_log_gitk_options
="
1484 --dense --sparse --full-history
1485 --simplify-merges --simplify-by-decoration
1486 --left-right --notes --no-notes
1488 # Options that go well for log and shortlog (not gitk)
1489 __git_log_shortlog_options
="
1490 --author= --committer= --grep=
1494 __git_log_pretty_formats
="oneline short medium full fuller email raw format:"
1495 __git_log_date_formats
="relative iso8601 rfc2822 short local default raw"
1499 __git_has_doubledash
&& return
1501 local g
="$(git rev-parse --git-dir 2>/dev/null)"
1503 if [ -f "$g/MERGE_HEAD" ]; then
1507 --pretty=*|
--format=*)
1508 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
1513 __gitcomp
"$__git_log_date_formats" "" "${cur##--date=}"
1517 __gitcomp
"long short" "" "${cur##--decorate=}"
1522 $__git_log_common_options
1523 $__git_log_shortlog_options
1524 $__git_log_gitk_options
1525 --root --topo-order --date-order --reverse
1526 --follow --full-diff
1527 --abbrev-commit --abbrev=
1528 --relative-date --date=
1529 --pretty= --format= --oneline
1532 --decorate --decorate=
1534 --parents --children
1536 $__git_diff_common_options
1537 --pickaxe-all --pickaxe-regex
1542 __git_complete_revlist
1545 __git_merge_options
="
1546 --no-commit --no-stat --log --no-log --squash --strategy
1547 --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
1552 __git_complete_strategy
&& return
1556 __gitcomp
"$__git_merge_options"
1559 __gitcomp_nl
"$(__git_refs)"
1566 __gitcomp
"$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
1578 __gitcomp_nl
"$(__git_refs)"
1585 __gitcomp
"--dry-run"
1590 if [ $
(__git_count_arguments
"mv") -gt 0 ]; then
1591 # We need to show both cached and untracked files (including
1592 # empty directories) since this may not be the last argument.
1593 __git_complete_index_file
"--cached --others --directory"
1595 __git_complete_index_file
"--cached"
1601 __gitcomp
"--tags --all --stdin"
1606 local subcommands
='add append copy edit list prune remove show'
1607 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
1609 case "$subcommand,$cur" in
1616 __gitcomp_nl
"$(__git_refs)"
1619 __gitcomp
"$subcommands --ref"
1623 add
,--reuse-message=*|append
,--reuse-message=*|\
1624 add
,--reedit-message=*|append
,--reedit-message=*)
1625 __gitcomp_nl
"$(__git_refs)" "" "${cur#*=}"
1628 __gitcomp
'--file= --message= --reedit-message=
1635 __gitcomp
'--dry-run --verbose'
1644 __gitcomp_nl
"$(__git_refs)"
1653 __git_complete_strategy
&& return
1658 --rebase --no-rebase
1659 $__git_merge_options
1660 $__git_fetch_options
1665 __git_complete_remote_or_refspec
1672 __gitcomp_nl
"$(__git_remotes)"
1677 __gitcomp_nl
"$(__git_remotes)" "" "${cur##--repo=}"
1682 --all --mirror --tags --dry-run --force --verbose
1683 --receive-pack= --repo= --set-upstream
1688 __git_complete_remote_or_refspec
1693 local dir
="$(__gitdir)"
1694 if [ -d "$dir"/rebase-apply
] ||
[ -d "$dir"/rebase-merge
]; then
1695 __gitcomp
"--continue --skip --abort"
1698 __git_complete_strategy
&& return
1701 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
1706 --onto --merge --strategy --interactive
1707 --preserve-merges --stat --no-stat
1708 --committer-date-is-author-date --ignore-date
1709 --ignore-whitespace --whitespace=
1715 __gitcomp_nl
"$(__git_refs)"
1720 local subcommands
="show delete expire"
1721 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
1723 if [ -z "$subcommand" ]; then
1724 __gitcomp
"$subcommands"
1726 __gitcomp_nl
"$(__git_refs)"
1730 __git_send_email_confirm_options
="always never auto cc compose"
1731 __git_send_email_suppresscc_options
="author self cc bodycc sob cccmd body all"
1738 $__git_send_email_confirm_options
1739 " "" "${cur##--confirm=}"
1744 $__git_send_email_suppresscc_options
1745 " "" "${cur##--suppress-cc=}"
1749 --smtp-encryption=*)
1750 __gitcomp
"ssl tls" "" "${cur##--smtp-encryption=}"
1756 " "" "${cur##--thread=}"
1760 __gitcomp
"--annotate --bcc --cc --cc-cmd --chain-reply-to
1761 --compose --confirm= --dry-run --envelope-sender
1763 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
1764 --no-suppress-from --no-thread --quiet
1765 --signed-off-by-cc --smtp-pass --smtp-server
1766 --smtp-server-port --smtp-encryption= --smtp-user
1767 --subject --suppress-cc= --suppress-from --thread --to
1768 --validate --no-validate
1769 $__git_format_patch_options"
1773 __git_complete_revlist
1781 __git_config_get_set_variables
()
1783 local prevword word config_file
= c
=$cword
1784 while [ $c -gt 1 ]; do
1787 --system|
--global|
--local|
--file=*)
1792 config_file
="$word $prevword"
1800 git
--git-dir="$(__gitdir)" config
$config_file --list 2>/dev
/null |
1814 branch.
*.remote|branch.
*.pushremote
)
1815 __gitcomp_nl
"$(__git_remotes)"
1819 __gitcomp_nl
"$(__git_refs)"
1823 __gitcomp
"false true"
1827 __gitcomp_nl
"$(__git_remotes)"
1831 local remote
="${prev#remote.}"
1832 remote
="${remote%.fetch}"
1833 if [ -z "$cur" ]; then
1834 __gitcomp_nl
"refs/heads/" "" "" ""
1837 __gitcomp_nl
"$(__git_refs_remotes "$remote")"
1841 local remote
="${prev#remote.}"
1842 remote
="${remote%.push}"
1843 __gitcomp_nl
"$(git --git-dir="$
(__gitdir
)" \
1844 for-each-ref --format='%(refname):%(refname)' \
1848 pull.twohead|pull.octopus
)
1849 __git_compute_merge_strategies
1850 __gitcomp
"$__git_merge_strategies"
1853 color.branch|color.
diff|color.interactive|\
1854 color.showbranch|color.status|color.ui
)
1855 __gitcomp
"always never auto"
1859 __gitcomp
"false true"
1864 normal black red green yellow blue magenta cyan white
1865 bold dim ul blink reverse
1870 __gitcomp
"log short"
1874 __gitcomp
"man info web html"
1878 __gitcomp
"$__git_log_date_formats"
1881 sendemail.aliasesfiletype
)
1882 __gitcomp
"mutt mailrc pine elm gnus"
1886 __gitcomp
"$__git_send_email_confirm_options"
1889 sendemail.suppresscc
)
1890 __gitcomp
"$__git_send_email_suppresscc_options"
1893 --get|
--get-all|
--unset|
--unset-all)
1894 __gitcomp_nl
"$(__git_config_get_set_variables)"
1904 --system --global --local --file=
1905 --list --replace-all
1906 --get --get-all --get-regexp
1907 --add --unset --unset-all
1908 --remove-section --rename-section
1913 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1914 __gitcomp
"remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
1918 local pfx
="${cur%.*}." cur_
="${cur#*.}"
1919 __gitcomp_nl
"$(__git_heads)" "$pfx" "$cur_" "."
1923 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1925 argprompt cmd confirm needsfile noconsole norescan
1926 prompt revprompt revunmerged title
1931 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1932 __gitcomp
"cmd path" "$pfx" "$cur_"
1936 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1937 __gitcomp
"cmd path" "$pfx" "$cur_"
1941 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1942 __gitcomp
"cmd path trustExitCode" "$pfx" "$cur_"
1946 local pfx
="${cur%.*}." cur_
="${cur#*.}"
1947 __git_compute_all_commands
1948 __gitcomp_nl
"$__git_all_commands" "$pfx" "$cur_"
1952 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1954 url proxy fetch push mirror skipDefaultUpdate
1955 receivepack uploadpack tagopt pushurl
1960 local pfx
="${cur%.*}." cur_
="${cur#*.}"
1961 __gitcomp_nl
"$(__git_remotes)" "$pfx" "$cur_" "."
1965 local pfx
="${cur%.*}." cur_
="${cur##*.}"
1966 __gitcomp
"insteadOf pushInsteadOf" "$pfx" "$cur_"
1972 advice.commitBeforeMerge
1974 advice.implicitIdentity
1975 advice.pushNonFastForward
1976 advice.resolveConflict
1980 apply.ignorewhitespace
1982 branch.autosetupmerge
1983 branch.autosetuprebase
1987 color.branch.current
1992 color.decorate.branch
1993 color.decorate.remoteBranch
1994 color.decorate.stash
2004 color.diff.whitespace
2009 color.grep.linenumber
2012 color.grep.separator
2014 color.interactive.error
2015 color.interactive.header
2016 color.interactive.help
2017 color.interactive.prompt
2022 color.status.changed
2024 color.status.nobranch
2025 color.status.untracked
2026 color.status.updated
2035 core.bigFileThreshold
2038 core.deltaBaseCacheLimit
2043 core.fsyncobjectfiles
2045 core.ignoreCygwinFSTricks
2048 core.logAllRefUpdates
2049 core.loosecompression
2052 core.packedGitWindowSize
2054 core.preferSymlinkRefs
2057 core.repositoryFormatVersion
2059 core.sharedRepository
2063 core.warnAmbiguousRefs
2066 diff.autorefreshindex
2068 diff.ignoreSubmodules
2075 diff.suppressBlankEmpty
2081 fetch.recurseSubmodules
2090 format.subjectprefix
2101 gc.reflogexpireunreachable
2105 gitcvs.commitmsgannotation
2106 gitcvs.dbTableNamePrefix
2117 gui.copyblamethreshold
2121 gui.matchtrackingbranch
2122 gui.newbranchtemplate
2123 gui.pruneduringfetch
2124 gui.spellingdictionary
2139 http.sslCertPasswordProtected
2144 i18n.logOutputEncoding
2150 imap.preformattedHTML
2160 interactive.singlekey
2176 mergetool.keepBackup
2177 mergetool.keepTemporaries
2182 notes.rewrite.rebase
2186 pack.deltaCacheLimit
2202 receive.denyCurrentBranch
2203 receive.denyDeleteCurrent
2205 receive.denyNonFastForwards
2208 receive.updateserverinfo
2211 repack.usedeltabaseoffset
2215 sendemail.aliasesfile
2216 sendemail.aliasfiletype
2220 sendemail.chainreplyto
2222 sendemail.envelopesender
2226 sendemail.signedoffbycc
2227 sendemail.smtpdomain
2228 sendemail.smtpencryption
2230 sendemail.smtpserver
2231 sendemail.smtpserveroption
2232 sendemail.smtpserverport
2234 sendemail.suppresscc
2235 sendemail.suppressfrom
2240 status.relativePaths
2241 status.showUntrackedFiles
2242 status.submodulesummary
2245 transfer.unpackLimit
2257 local subcommands
="add rename remove set-head set-branches set-url show prune update"
2258 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2259 if [ -z "$subcommand" ]; then
2260 __gitcomp
"$subcommands"
2264 case "$subcommand" in
2265 rename|remove|set-url|show|prune
)
2266 __gitcomp_nl
"$(__git_remotes)"
2268 set-head|set-branches
)
2269 __git_complete_remote_or_refspec
2272 local i c
='' IFS
=$
'\n'
2273 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "remotes\..*" 2>/dev
/null
); do
2286 __gitcomp_nl
"$(__git_refs)"
2291 __git_has_doubledash
&& return
2295 __gitcomp
"--merge --mixed --hard --soft --patch"
2299 __gitcomp_nl
"$(__git_refs)"
2306 __gitcomp
"--edit --mainline --no-edit --no-commit --signoff"
2310 __gitcomp_nl
"$(__git_refs)"
2317 __gitcomp
"--cached --dry-run --ignore-unmatch --quiet"
2322 __git_complete_index_file
"--cached"
2327 __git_has_doubledash
&& return
2332 $__git_log_common_options
2333 $__git_log_shortlog_options
2334 --numbered --summary
2339 __git_complete_revlist
2344 __git_has_doubledash
&& return
2347 --pretty=*|
--format=*)
2348 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
2353 __gitcomp
"$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
2357 __gitcomp
"--pretty= --format= --abbrev-commit --oneline
2358 $__git_diff_common_options
2371 --all --remotes --topo-order --current --more=
2372 --list --independent --merge-base --no-name
2374 --sha1-name --sparse --topics --reflog
2379 __git_complete_revlist
2384 local save_opts
='--keep-index --no-keep-index --quiet --patch'
2385 local subcommands
='save list show apply clear drop pop create branch'
2386 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2387 if [ -z "$subcommand" ]; then
2390 __gitcomp
"$save_opts"
2393 if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
2394 __gitcomp
"$subcommands"
2399 case "$subcommand,$cur" in
2401 __gitcomp
"$save_opts"
2404 __gitcomp
"--index --quiet"
2406 show
,--*|drop
,--*|branch
,--*)
2408 show
,*|apply
,*|drop
,*|pop
,*|branch
,*)
2409 __gitcomp_nl
"$(git --git-dir="$
(__gitdir
)" stash list \
2410 | sed -n -e 's/:.*//p')"
2420 __git_has_doubledash
&& return
2422 local subcommands
="add status init deinit update summary foreach sync"
2423 if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
2426 __gitcomp
"--quiet --cached"
2429 __gitcomp
"$subcommands"
2439 init fetch clone rebase dcommit log find-rev
2440 set-tree commit-diff info create-ignore propget
2441 proplist show-ignore show-externals branch tag blame
2442 migrate mkdirs reset gc
2444 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2445 if [ -z "$subcommand" ]; then
2446 __gitcomp
"$subcommands"
2448 local remote_opts
="--username= --config-dir= --no-auth-cache"
2450 --follow-parent --authors-file= --repack=
2451 --no-metadata --use-svm-props --use-svnsync-props
2452 --log-window-size= --no-checkout --quiet
2453 --repack-flags --use-log-author --localtime
2454 --ignore-paths= --include-paths= $remote_opts
2457 --template= --shared= --trunk= --tags=
2458 --branches= --stdlayout --minimize-url
2459 --no-metadata --use-svm-props --use-svnsync-props
2460 --rewrite-root= --prefix= --use-log-author
2461 --add-author-from $remote_opts
2464 --edit --rmdir --find-copies-harder --copy-similarity=
2467 case "$subcommand,$cur" in
2469 __gitcomp
"--revision= --fetch-all $fc_opts"
2472 __gitcomp
"--revision= $fc_opts $init_opts"
2475 __gitcomp
"$init_opts"
2479 --merge --strategy= --verbose --dry-run
2480 --fetch-all --no-rebase --commit-url
2481 --revision --interactive $cmt_opts $fc_opts
2485 __gitcomp
"--stdin $cmt_opts $fc_opts"
2487 create-ignore
,--*|propget
,--*|proplist
,--*|show-ignore
,--*|\
2488 show-externals
,--*|mkdirs
,--*)
2489 __gitcomp
"--revision="
2493 --limit= --revision= --verbose --incremental
2494 --oneline --show-commit --non-recursive
2495 --authors-file= --color
2500 --merge --verbose --strategy= --local
2501 --fetch-all --dry-run $fc_opts
2505 __gitcomp
"--message= --file= --revision= $cmt_opts"
2511 __gitcomp
"--dry-run --message --tag"
2514 __gitcomp
"--dry-run --message"
2517 __gitcomp
"--git-format"
2521 --config-dir= --ignore-paths= --minimize
2522 --no-auth-cache --username=
2526 __gitcomp
"--revision= --parent"
2537 while [ $c -lt $cword ]; do
2541 __gitcomp_nl
"$(__git_tags)"
2556 __gitcomp_nl
"$(__git_tags)"
2560 __gitcomp_nl
"$(__git_refs)"
2572 local i c
=1 command __git_dir
2574 while [ $c -lt $cword ]; do
2577 --git-dir=*) __git_dir
="${i#--git-dir=}" ;;
2578 --bare) __git_dir
="." ;;
2579 --help) command="help"; break ;;
2582 *) command="$i"; break ;;
2587 if [ -z "$command" ]; then
2601 --no-replace-objects
2605 *) __git_compute_porcelain_commands
2606 __gitcomp
"$__git_porcelain_commands $(__git_aliases)" ;;
2611 local completion_func
="_git_${command//-/_}"
2612 declare -f $completion_func >/dev
/null
&& $completion_func && return
2614 local expansion
=$
(__git_aliased_command
"$command")
2615 if [ -n "$expansion" ]; then
2616 completion_func
="_git_${expansion//-/_}"
2617 declare -f $completion_func >/dev
/null
&& $completion_func
2623 __git_has_doubledash
&& return
2625 local g
="$(__gitdir)"
2627 if [ -f "$g/MERGE_HEAD" ]; then
2633 $__git_log_common_options
2634 $__git_log_gitk_options
2640 __git_complete_revlist
2643 if [[ -n ${ZSH_VERSION-} ]]; then
2644 echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
2646 autoload
-U +X compinit
&& compinit
2652 local cur_
="${3-$cur}"
2658 local c IFS
=$
' \t\n'
2666 array
[$#array+1]="$c"
2669 compadd
-Q -S '' -p "${2-}" -a -- array
&& _ret
=0
2680 compadd
-Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
2689 compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
2695 local cur cword prev
2696 cur=${words[CURRENT-1]}
2697 prev=${words[CURRENT-2]}
2707 let _ret && _default -S '' && _ret=0
2711 compdef _git git gitk
2713 elif [[ -n ${BASH_VERSION-} ]]; then
2714 if ((${BASH_VERSINFO[0]} < 4)); then
2715 # compopt is not supported
2716 __git_index_file_list_filter ()
2718 __git_index_file_list_filter_compat
2725 local cur words cword prev
2726 _get_comp_words_by_ref -n =: cur words cword prev
2730 # Setup completion for certain functions defined above by setting common
2731 # variables and workarounds.
2732 # This is NOT a public function; use at your own risk.
2735 local wrapper="__git_wrap
${2}"
2736 eval "$wrapper () { __git_func_wrap
$2 ; }"
2737 complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \
2738 || complete -o default -o nospace -F $wrapper $1
2741 # wrapper for backwards compatibility
2744 __git_wrap__git_main
2747 # wrapper for backwards compatibility
2750 __git_wrap__gitk_main
2753 __git_complete git __git_main
2754 __git_complete gitk __gitk_main
2756 # The following are necessary only for Cygwin, and only are needed
2757 # when the user has tab-completed the executable name and consequently
2758 # included the '.exe' suffix.
2760 if [ Cygwin = "$
(uname
-o 2>/dev
/null
)" ]; then
2761 __git_complete git.exe __git_main