fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Collin StylesAdd completions for `git history fixup`1dee927c9

master
243.2 KiB3046 linesraw
1# fish completion for git
2
3# Use this instead of calling git directly; it passes the commands that are
4# already present on the commandline to git. This is relevant for --work-tree etc, see issue #6219.
5function __fish_git
6    set -l saved_args $argv
7    set -l global_args
8    set -l cmd (commandline -xpc)
9    # We assume that git is the first command until we have a better awareness of subcommands, see #2705.
10    set -e cmd[1]
11    if argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null
12        # All arguments that were parsed by argparse are global git options.
13        set -l num_global_args (math (count $cmd) - (count $argv))
14        if test $num_global_args -ne 0
15            set global_args $cmd[1..$num_global_args]
16        end
17    end
18    # Using 'command git' to avoid interactions for aliases from git to (e.g.) hub
19    command git $global_args $saved_args 2>/dev/null
20end
21
22# Print an optspec for argparse to handle git's options that are independent of any subcommand.
23function __fish_git_global_optspecs
24    string join \n v-version h/help C= c=+ 'e-exec-path=?' H-html-path M-man-path I-info-path p/paginate \
25        P/no-pager o-no-replace-objects b-bare G-git-dir= W-work-tree= N-namespace= S-super-prefix= \
26        l-literal-pathspecs g-glob-pathspecs O-noglob-pathspecs i-icase-pathspecs
27end
28
29function __fish_git_commits
30    # Complete commits with their subject line as the description
31    # This allows filtering by subject with the new pager!
32    # Because even subject lines can be quite long,
33    # trim them (abbrev'd hash+tab+subject) to 73 characters
34    #
35    # Hashes we just truncate ourselves to 10 characters, without disambiguating.
36    # That technically means that sometimes we don't give usable SHAs,
37    # but according to https://stackoverflow.com/a/37403152/3150338,
38    # that happens for 3 commits out of 600k.
39    # For fish, at the time of writing, out of 12200 commits, 7 commits need 8 characters.
40    # And since this takes about 1/3rd of the time that disambiguating takes...
41    __fish_git log --no-show-signature --pretty=tformat:"%H"\t"%<(64,trunc)%s" --all --max-count=1000 2>/dev/null \
42        | string replace -r '^([0-9a-f]{10})[0-9a-f]*\t(.*)' '$1\t$2'
43end
44
45function __fish_git_recent_commits
46    # Like __fish_git_commits, but not on all branches and limited to
47    # the last 50 commits. Used for fixup, where only the current branch
48    # and the latest commits make sense.
49    __fish_git log --no-show-signature --pretty=tformat:"%h"\t"%<(64,trunc)%s" --max-count=50 $argv 2>/dev/null
50end
51
52function __fish_git_branches
53    # This is much faster than using `git branch` and avoids dealing with localized "detached HEAD" messages.
54    # We intentionally only sort local branches by recency. See discussion in #9248.
55    __fish_git_local_branches
56    __fish_git_remote_branches
57end
58
59function __fish_git_submodules
60    __fish_git submodule 2>/dev/null \
61        | string replace -r '^.[^ ]+ ([^ ]+).*$' '$1'
62end
63
64function __fish_git_local_branches
65    __fish_git for-each-ref --format='%(refname:strip=2)%09Local Branch' --sort=-committerdate refs/heads/ 2>/dev/null
66end
67
68function __fish_git_remote_branches
69    __fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
70end
71
72function __fish_git_unique_remote_branches
73    # `git checkout` accepts remote branches without the remote part
74    # if they are unambiguous.
75    # E.g. if only alice has a "frobulate" branch
76    # `git checkout frobulate` is equivalent to `git checkout -b frobulate --track alice/frobulate`.
77    __fish_git for-each-ref --format="%(refname:strip=3)" \
78        --sort="refname:strip=3" \
79        refs/remotes/ 2>/dev/null | uniq -u
80end
81
82function __fish_git_tags
83    __fish_git tag --sort=-creatordate 2>/dev/null
84end
85
86function __fish_git_heads
87    set -l gitdir (__fish_git rev-parse --git-dir 2>/dev/null)
88    or return # No git dir, no need to even test.
89    for head in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD REVERT_HEAD \
90        CHERRY_PICK_HEAD BISECT_HEAD AUTO_MERGE
91        if test -f $gitdir/$head
92            echo $head
93        end
94    end
95end
96
97function __fish_git_remote_heads
98    # Example of output parsed:
99    # "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git"
100    __fish_git for-each-ref --format="%(refname:strip=2)" 'refs/remotes/*/HEAD' | path dirname
101end
102
103function __fish_git_refs
104    __fish_git_branches
105    __fish_git_tags
106    __fish_git_heads
107end
108
109function __fish_git_remotes
110    # Example of output parsed:
111    # "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git"
112    __fish_git config --get-regexp '^remote\.[^[:space:]]+\.url$' | string replace -rf '^remote\.(\S+)\.url (.*)' '$1\t$2'
113end
114
115set -g __fish_git_recent_commits_arg
116set -g __fish_git_unqualified_unique_remote_branches false
117set -g __fish_git_filter_non_pushable ''
118
119function __fish_git_add_revision_completion
120    set -l c complete -f -c git $argv -n 'not contains -- -- (commandline -xpc)' -ka
121    # The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
122    $c "(__fish_git_recent_commits $__fish_git_recent_commits_arg $__fish_git_filter_non_pushable)"
123    $c "(__fish_git_tags)" -d Tag
124    $c "(__fish_git_remote_heads $__fish_git_filter_non_pushable)" -d 'Remote alias'
125    $c "(__fish_git_heads $__fish_git_filter_non_pushable)" -d Head
126    $c "(__fish_git_remote_branches $__fish_git_filter_non_pushable)"
127    if $__fish_git_unqualified_unique_remote_branches
128        $c "(__fish_git_unique_remote_branches $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
129    end
130    $c "(__fish_git_local_branches)" -d 'Local Branch'
131end
132
133function __fish_git_files
134    # A function to show various kinds of files git knows about,
135    # by parsing `git status --porcelain`.
136    #
137    # This accepts arguments to denote the kind of files:
138    # - added: Staged added files (unstaged adds are untracked)
139    # - copied
140    # - deleted
141    # - deleted-staged
142    # - ignored
143    # - modified: Files that have been modified (but aren't staged)
144    # - modified-staged: Staged modified files
145    # - renamed
146    # - untracked
147    # and as a convenience "all-staged"
148    # to get _all_ kinds of staged files.
149
150    # Save the repo root to remove it from the path later.
151    set -l root (__fish_git rev-parse --show-toplevel --is-bare-repository 2>/dev/null)
152    or return
153
154    # Skip bare repositories.
155    test "$root[2]" = true
156    and return
157    or set -e root[2]
158
159    # Cache the translated descriptions so we don't have to get it
160    # once per file.
161    contains -- all-staged $argv; and set -l all_staged
162    contains -- unmerged $argv; and set -l unmerged
163    and set -l unmerged_desc "Unmerged File"
164    contains -- added $argv; or set -ql all_staged; and set -l added
165    and set -l added_desc "Added file"
166    contains -- modified $argv; and set -l modified
167    and set -l modified_desc "Modified file"
168    contains -- untracked $argv; and set -l untracked
169    and set -l untracked_desc "Untracked file"
170    contains -- modified-staged $argv; or set -ql all_staged; and set -l modified_staged
171    and set -l staged_modified_desc "Staged modified file"
172    contains -- modified-staged-deleted $argv; or set -ql modified_staged; and set -l modified_staged_deleted
173    and set -l modified_staged_deleted_desc "Staged modified and deleted file"
174    contains -- deleted $argv; and set -l deleted
175    and set -l deleted_desc "Deleted file"
176    contains -- deleted-staged $argv; or set -ql all_staged; and set -l deleted_staged
177    and set -l staged_deleted_desc "Staged deleted file"
178    contains -- ignored $argv; and set -l ignored
179    and set -l ignored_desc "Ignored file"
180    contains -- renamed $argv; and set -l renamed
181    and set -l renamed_desc "Renamed file"
182    contains -- copied $argv; and set -l copied
183    and set -l copied_desc "Copied file"
184
185    # git status --porcelain gives us all the info we need, in a format we don't.
186    # The v2 format has better documentation and doesn't use " " to denote anything,
187    # but it's only been added in git 2.11.0, which was released November 2016.
188
189    # Also, we ignore submodules because they aren't useful as arguments (generally),
190    # and they slow things down quite significantly.
191    # E.g. `git reset $submodule` won't do anything (not even print an error).
192    # --ignore-submodules=all was added in git 1.7.2, released July 2010.
193    #
194    set -l status_opt --ignore-submodules=all
195
196    # If we aren't looking for ignored files, let git status skip them.
197    # (don't use --ignored=no because that was only added in git 2.16, from Jan 2018.
198    set -q ignored; and set -a status_opt --ignored
199
200    # We need to set status.relativePaths to true because the porcelain v2 format still honors that,
201    # and core.quotePath to false so characters > 0x80 (i.e. non-ASCII) aren't considered special.
202    # We explicitly enable globs so we can use that to match the current token.
203    set -l git_opt -c status.relativePaths -c core.quotePath=
204
205    # If the token starts with `./`, we need to prepend that
206    string match -q './*' -- (commandline -ct)
207    and set -l rel ./
208    or set -l rel
209
210    # If the token starts with `:`, it's from the repo root
211    string match -q ':*' -- (commandline -ct)
212    and set -l colon 1
213    or set -l colon
214
215    # We pick the v2 format if we can, because it shows relative filenames (if used without "-z").
216    # We fall back on the v1 format by reading git's _version_, because trying v2 first is too slow.
217    set -l ver (__fish_git --version | string replace -rf 'git version (\d+)\.(\d+)\.?.*' '$1\n$2')
218    # Version >= 2.11.* has the v2 format.
219    if test "$ver[1]" -gt 2 2>/dev/null; or test "$ver[1]" -eq 2 -a "$ver[2]" -ge 11 2>/dev/null
220        set -l stats (__fish_git $git_opt status --porcelain=2 -uno $status_opt)
221        if set -ql untracked
222            # Fast path for untracked files - it is extremely easy to get a lot of these,
223            # so we handle them separately.
224            set -l files (__fish_git $git_opt ls-files -o --exclude-standard)
225            printf "$rel%s\n" $files\t$untracked_desc
226            if set -ql colon[1]
227                or set files (string match '../*' -- $files)
228                set files (path resolve -- $files | string replace -- "$root/" ":/:")
229                and printf '%s\n' $files\t$untracked_desc
230            end
231        end
232        printf %s\n $stats | while read -la -d ' ' line
233            set -l file
234            set -l desc
235            # The basic status format is "XY", where X is "our" state (meaning the staging area),
236            # and "Y" is "their" state.
237            # A "." means it's unmodified.
238            switch "$line[1..2]"
239                case 'u *'
240                    # Unmerged
241                    # "Unmerged entries have the following format; the first character is a "u" to distinguish from ordinary changed entries."
242                    # "u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>"
243                    # This is first to distinguish it from normal modifications et al.
244                    set -ql unmerged
245                    and set file "$line[11..-1]"
246                    and set desc $unmerged_desc
247                case '2 .R*' '2 R.*'
248                    # Renamed/Copied
249                    # From the docs: "Renamed or copied entries have the following format:"
250                    # "2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>"
251                    # Since <sep> is \t, we can't really parse it unambiguously.
252                    # The "-z" format would be great here!
253                    set -ql renamed
254                    and set file (string replace -r '\t[^\t]*' '' -- "$line[10..-1]")
255                    and set desc $renamed_desc
256                case '2 RM*' '2 RT*'
257                    # Staged as renamed, with unstaged modifications (issue #6031)
258                    set -ql renamed
259                    or set -ql modified
260                    and set file (string replace -r '\t[^\t]*' '' -- "$line[10..-1]")
261                    set -ql renamed
262                    and set desc $renamed_desc
263                    set -ql modified
264                    and set --append desc $modified_desc
265                case '2 RD*'
266                    # Staged as renamed, but deleted in the worktree
267                    set -ql renamed
268                    or set -ql deleted
269                    and set file (string replace -r '\t[^\t]*' '' -- "$line[10..-1]")
270                    set -ql renamed
271                    and set desc $renamed_desc
272                    set -ql deleted
273                    and set --append desc $deleted_desc
274                case '2 .C*' '2 C.*'
275                    set -ql copied
276                    and set file (string replace -r '\t[^\t].*' '' -- "$line[10..-1]")
277                    and set desc $copied_desc
278                case '1 A.*'
279                    # Additions are only shown here if they are staged.
280                    # Otherwise it's an untracked file.
281                    set -ql added
282                    and set file "$line[9..-1]"
283                    and set desc $added_desc
284                case '1 AD*'
285                    # Added files that were since deleted
286                    if set -ql added
287                        set file "$line[9..-1]"
288                        set desc $added_desc
289                    else if set -ql deleted
290                        set file "$line[9..-1]"
291                        set desc $deleted_desc
292                    end
293                case "1 AM*" "1 AT*"
294                    # Added files with additional modifications
295                    # ("T" is type-changed. As of git 2.33 this appears to be undocumented.
296                    # it happens when e.g. a file is replaced with a symlink.
297                    # For our purposes it's the same as modified)
298                    if set -ql added
299                        set file "$line[9..-1]"
300                        set desc $added_desc
301                    else if set -ql modified
302                        set file "$line[9..-1]"
303                        set desc $modified_desc
304                    end
305                case '1 .A*'
306                    # Files added with git add --intent-to-add.
307                    set -ql untracked
308                    and set file "$line[9..-1]"
309                    and set desc $untracked_desc
310                case '1 .M*' '1 .T*'
311                    # Modified
312                    # From the docs: "Ordinary changed entries have the following format:"
313                    # "1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>"
314                    # Since <path> can contain spaces, print from element 9 onwards
315                    set -ql modified
316                    and set file "$line[9..-1]"
317                    and set desc $modified_desc
318                case '1 MD*' '1 TD*'
319                    set -ql modified_staged_deleted
320                    and set file "$line[9..-1]"
321                    and set desc $modified_staged_deleted_desc
322                case '1 M.*' '1 T.*'
323                    # If the character is first ("M."), then that means it's "our" change,
324                    # which means it is staged.
325                    # This is useless for many commands - e.g. `checkout` won't do anything with this.
326                    # So it needs to be requested explicitly.
327                    set -ql modified_staged
328                    and set file "$line[9..-1]"
329                    and set desc $staged_modified_desc
330                case '1 MM*' '1 MT*' '1 TM*' '1 TT*'
331                    # Staged-modified with unstaged modifications
332                    # These need to be offered for both kinds of modified.
333                    if set -ql modified
334                        set file "$line[9..-1]"
335                        set desc $modified_desc
336                    else if set -ql modified_staged
337                        set file "$line[9..-1]"
338                        set desc $staged_modified_desc
339                    end
340                case '1 .D*'
341                    set -ql deleted
342                    and set file "$line[9..-1]"
343                    and set desc $deleted_desc
344                case '1 D.*'
345                    # TODO: The docs are unclear on this.
346                    # There is both X unmodified and Y either M or D ("not updated")
347                    # and Y is D and X is unmodified or [MARC] ("deleted in work tree").
348                    # For our purposes, we assume this is a staged deletion.
349                    set -ql deleted_staged
350                    and set file "$line[9..-1]"
351                    and set desc $staged_deleted_desc
352                case '! *'
353                    # Ignored
354                    # "! <path>" - print from element 2 on.
355                    set -ql ignored
356                    and set file "$line[2..-1]"
357                    and set desc $ignored_desc
358            end
359            # Only try printing if the file was selected.
360            if set -q file[1]
361                # Without "-z", git sometimes _quotes_ filenames.
362                # It adds quotes around it _and_ escapes the character.
363                # e.g. `"a\\b"`.
364                # We just remove the quotes and hope it works out.
365                # If this contains newlines or tabs,
366                # there is nothing we can do, but that's a general issue with scripted completions.
367                set file (string trim -c \" -- $file)
368                # The (possibly relative) filename.
369                printf "$rel%s\n" "$file"\t$desc
370                # Now from repo root.
371                # Only do this if the filename isn't a simple child,
372                # or the current token starts with ":"
373                if set -ql colon[1]; or string match -q '../*' -- $file
374                    set -l fromroot (path resolve -- $file 2>/dev/null)
375                    # `:` starts pathspec "magic", and the second `:` terminates it.
376                    # `/` is the magic letter for "from repo root".
377                    # If we didn't terminate it we'd have to escape any special chars
378                    # (non-alphanumeric, glob or regex special characters, in whatever dialect git uses)
379                    and set fromroot (string replace -- "$root/" ":/:" "$fromroot")
380                    and printf '%s\n' "$fromroot"\t$desc
381                end
382            end
383        end
384    else
385        # v1 format logic
386        # This is pretty terrible and requires us to do a lot of weird work.
387
388        # A literal "?" for use in `case`.
389        set -l q '\\?'
390        if status test-feature qmark-noglob
391            set q '?'
392        end
393        # Whether we need to use the next line - some entries have two lines.
394        set -l use_next
395
396        # We need to compute relative paths on our own, which is slow.
397        # Pre-remove the root at least, so we have fewer components to deal with.
398        set -l _pwd_list (string replace "$root/" "" -- $PWD/ | string split /)
399        test -z "$_pwd_list[-1]"; and set -e _pwd_list[-1]
400        # Cache the previous relative path because these are sorted, so we can reuse it
401        # often for files in the same directory.
402        set -l previous
403        # Note that we can't use space as a delimiter between status and filename, because
404        # the status can contain spaces - " M" is different from "M ".
405        __fish_git $git_opt status --porcelain -z $status_opt \
406            | while read -lz -d' ' line
407            set -l desc
408            # The entire line is the "from" from a rename.
409            if set -q use_next[1]
410                if contains -- $use_next $argv
411                    set -l var "$use_next"_desc
412                    set desc $$var
413                    set -e use_next[1]
414                else
415                    set -e use_next[1]
416                    continue
417                end
418            end
419
420            # The format is two characters for status, then a space and then
421            # up to a NUL for the filename.
422            #
423            set -l stat (string sub -l 2 -- $line)
424            # The basic status format is "XY", where X is "our" state (meaning the staging area),
425            # and "Y" is "their" state (meaning the work tree).
426            # A " " means it's unmodified.
427            #
428            # Be careful about the ordering here!
429            switch "$stat"
430                case DD AU UD UA DU AA UU
431                    # Unmerged
432                    set -ql unmerged
433                    and set desc $unmerged_desc
434                case 'R ' RM RD
435                    # Renamed/Copied
436                    # These have the "from" name as the next batch.
437                    # TODO: Do we care about the new name?
438                    set use_next renamed
439                    continue
440                case 'C ' CM CD
441                    set use_next copied
442                    continue
443                case AM
444                    if set -ql added
445                        set file "$line[9..-1]"
446                        set desc $added_desc
447                    else if set -ql modified
448                        set file "$line[9..-1]"
449                        set desc $modified_desc
450                    end
451                case AD
452                    if set -ql added
453                        set file "$line[9..-1]"
454                        set desc $added_desc
455                    else if set -ql deleted
456                        set file "$line[9..-1]"
457                        set desc $deleted_desc
458                    end
459                case 'A '
460                    # Additions are only shown here if they are staged.
461                    # Otherwise it's an untracked file.
462                    set -ql added
463                    and set desc $added_desc
464                case '*M'
465                    # Modified
466                    set -ql modified
467                    and set desc $modified_desc
468                case 'M*'
469                    # If the character is first ("M "), then that means it's "our" change,
470                    # which means it is staged.
471                    # This is useless for many commands - e.g. `checkout` won't do anything with this.
472                    # So it needs to be requested explicitly.
473                    set -ql modified_staged
474                    and set desc $staged_modified_desc
475                case '*D'
476                    set -ql deleted
477                    and set desc $deleted_desc
478                case 'D*'
479                    # TODO: The docs are unclear on this.
480                    # There is both X unmodified and Y either M or D ("not updated")
481                    # and Y is D and X is unmodified or [MARC] ("deleted in work tree").
482                    # For our purposes, we assume this is a staged deletion.
483                    set -ql deleted_staged
484                    and set desc $staged_deleted_desc
485                case "$q$q"
486                    # Untracked
487                    set -ql untracked
488                    and set desc $untracked_desc
489                case '!!'
490                    # Ignored
491                    set -ql ignored
492                    and set desc $ignored_desc
493            end
494            if set -q desc[1]
495                # Again: "XY filename", so the filename starts on character 4.
496                set -l relfile (string sub -s 4 -- $line)
497
498                set -l file
499                # Computing relative path by hand.
500                set -l abs (string split / -- $relfile)
501                # If it's in the same directory, we just need to change the filename.
502                if test "$abs[1..-2]" = "$previous[1..-2]"
503                    # If we didn't have a previous file, and the current file is in the current directory,
504                    # this would error out.
505                    #
506                    # See #5728.
507                    set -q previous[1]
508                    and set previous[-1] $abs[-1]
509                    or set previous $abs
510                else
511                    set -l pwd_list $_pwd_list
512                    # Remove common prefix
513                    while test "$pwd_list[1]" = "$abs[1]"
514                        set -e pwd_list[1]
515                        set -e abs[1]
516                    end
517                    # Go a dir up for every entry left in pwd_list, then into $abs
518                    set previous (string replace -r '.*' '..' -- $pwd_list) $abs
519                end
520                set -a file (string join / -- $previous)
521
522                # The filename with ":/:" prepended.
523                if set -ql colon[1]; or string match -q '../*' -- $file
524                    set file (string replace -- "$root/" ":/:" "$root/$relfile")
525                end
526
527                if test "$root/$relfile" -ef "$relfile"
528                    and not set -ql colon[1]
529                    set file $relfile
530                end
531
532                printf '%s\n' $file\t$desc
533            end
534        end
535    end
536end
537
538# Lists files included in the index of a commit, branch, or tag (not necessarily HEAD)
539function __fish_git_rev_files
540    set -l rev $argv[1]
541    set -l path $argv[2]
542
543    # Strip any partial files from the path before handing it to `git show`
544    set -l path (string replace -r -- '(.*/|).*' '$1' $path)
545
546    # List files in $rev's index, skipping the "tree ..." header, but appending
547    # the parent path, which git does not include in the output (and fish requires)
548    string join \n -- $path(__fish_git show $rev:$path | sed '1,2d')
549end
550
551# Provides __fish_git_rev_files completions for the current token
552function __fish_git_complete_rev_files
553    set -l split (string split -m 1 ":" -- (commandline -xt))
554    set -l rev $split[1]
555    set -l path $split[2]
556
557    printf "$rev:%s\n" (__fish_git_rev_files $rev $path)
558end
559
560# Determines whether we can/should complete with __fish_git_rev_files
561function __fish_git_needs_rev_files
562    # git (as of 2.20) accepts the rev:path syntax for a number of subcommands,
563    # but then doesn't emit the expected (or any?) output, e.g. `git log master:foo`
564    #
565    # This definitely works with `git show` to retrieve a copy of a file as it exists
566    # in the index of revision $rev, it should be updated to include others as they
567    # are identified.
568    __fish_git_using_command show; and string match -r "^[^-].*:" -- (commandline -xt)
569end
570
571function __fish_git_ranges
572    set -l both (commandline -xt | string replace -r '\.{2,3}' \n\$0\n)
573    set -l from $both[1]
574    set -l dots $both[2]
575    # If we didn't need to split (or there's nothing _to_ split), complete only the first part
576    # Note that status here is from `string replace` because `set` doesn't alter it
577    if test -z "$from" -o $status -gt 0
578        if commandline -ct | string match -q '*..*'
579            # The cursor is right of a .. range operator, make sure to include them first.
580            __fish_git_refs | string replace -r '' "$dots"
581        else
582            __fish_git_refs | string replace \t "$dots"\t
583        end
584        return 0
585    end
586
587    set -l from_refs
588    if commandline -ct | string match -q '*..*'
589        # If the cursor is right of a .. range operator, only complete the right part.
590        set from_refs $from
591    else
592        set from_refs (__fish_git_refs | string match -e "$from" | string replace -r \t'.*$' '')
593    end
594
595    set -l to $both[3]
596    # Remove description from the from-ref, not the to-ref.
597    for from_ref in $from_refs
598        for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty, this correctly matches everything
599            printf "%s%s%s\n" $from_ref $dots $to_ref
600        end
601    end
602end
603
604function __fish_git_needs_command
605    # Figure out if the current invocation already has a command.
606    #
607    # This is called hundreds of times and the argparse is kinda slow,
608    # so we cache it as long as the commandline doesn't change.
609    set -l cmdline "$(commandline -c)"
610    if set -q __fish_git_cmdline; and test "$cmdline" = "$__fish_git_cmdline"
611        if set -q __fish_git_cmd[1]
612            echo -- $__fish_git_cmd
613            return 1
614        end
615        return 0
616    end
617    set -g __fish_git_cmdline $cmdline
618
619    set -l cmd (commandline -xpc)
620    set -e cmd[1]
621    argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null
622    or return 0
623    # These flags function as commands, effectively.
624    set -q _flag_version; and return 1
625    set -q _flag_html_path; and return 1
626    set -q _flag_man_path; and return 1
627    set -q _flag_info_path; and return 1
628    if set -q argv[1]
629        # Also print the command, so this can be used to figure out what it is.
630        set -g __fish_git_cmd $argv[1]
631        echo $argv[1]
632        return 1
633    end
634    set -g __fish_git_cmd
635    return 0
636end
637
638function __fish_git_dash_in_token
639    commandline -t | string match -q -- '*-*'
640end
641
642function __fish_git_config_keys
643    # Print already defined config values first
644    # Config keys may span multiple lines, so parse using null char
645    # With -z, key and value are separated by space, not "="
646    __fish_git config -lz | while read -lz key value
647        # Print only first line of value(with an ellipsis) if multiline
648        printf '%s\t%s\n' $key (string shorten -N -- $value)
649    end
650    # Print all recognized config keys; duplicates are not shown twice by fish
651    printf '%s\n' (__fish_git help --config)[1..-2] # Last line is a footer; ignore it
652end
653
654# HACK: Aliases
655# Git allows aliases, so we need to see what command the current command-token corresponds to
656# (so we can complete e.g. `lg` like `log`).
657# Checking `git config` for a lot of aliases can be quite slow if it is called
658# for every possible command.
659# Ideally, we'd `complete --wraps` this, but that is not currently possible, as is
660# using `complete -C` like
661# complete -c git -n '__fish_git_using_command lg' -a '(complete -C"git log ")'
662#
663# So instead, we store the aliases in global variables, named after the alias, containing the command.
664# This is because alias:command is an n:1 mapping (an alias can only have one corresponding command,
665#                                                  but a command can be aliased multiple times)
666
667# Approximately duplicates the logic from https://github.com/git/git/blob/d486ca60a51c9cb1fe068803c3f540724e95e83a/contrib/completion/git-completion.bash#L1130
668# The bash script also finds aliases that reference other aliases via a loop but we handle that separately
669function __fish_git_aliased_command
670    for word in (string split ' ' -- $argv)
671        switch $word
672            case !gitk gitk
673                echo gitk
674                return
675                # Adding " to the list
676            case '!*' '-*' '*=*' git '()' '{' : '\'*' '"*'
677                continue
678            case '*'
679                echo $word
680                return
681        end
682    end
683end
684
685set -g __fish_git_aliases
686git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline
687    set -l command (__fish_git_aliased_command $cmdline)
688    string match -q --regex '\w+' -- $command; or continue
689    # Git aliases can contain chars that variable names can't - escape them.
690    set -l alias (string replace 'alias.' '' -- $alias | string escape --style=var)
691    set -g __fish_git_alias_$alias $command $cmdline
692    set --append -g __fish_git_aliases $alias
693end
694
695# Resolve aliases that call another alias
696for alias in $__fish_git_aliases
697    set -l handled $alias
698
699    while true
700        set -l alias_varname __fish_git_alias_$alias
701        set -l aliased_command $$alias_varname[1][1]
702        set -l aliased_escaped (string escape --style=var -- $aliased_command)
703        set -l aliased_varname __fish_git_alias_$aliased_escaped
704        set -q $aliased_varname
705        or break
706
707        # stop infinite recursion
708        contains $aliased_escaped $handled
709        and break
710
711        # expand alias in cmdline
712        set -l aliased_cmdline $$alias_varname[1][2]
713        set -l aliased_cmdline (string replace " $aliased_command " " $$aliased_varname[1][2..-1] " -- " $aliased_cmdline ")
714        set -g $alias_varname $$aliased_varname[1][1] (string trim "$aliased_cmdline")
715        set --append handled $aliased_escaped
716    end
717end
718
719function __fish_git_using_command
720    set -l cmd (__fish_git_needs_command)
721    test -z "$cmd"
722    and return 1
723    contains -- $cmd $argv
724    and return 0
725
726    # Check aliases.
727    set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
728    set -q $varname
729    and contains -- $$varname[1][1] $argv
730    and return 0
731    return 1
732end
733
734function __fish_git_contains_opt
735    # Check if an option has been given
736    # First check the commandline normally
737    __fish_contains_opt $argv
738    and return
739
740    # Now check the alias
741    argparse s= -- $argv
742    set -l cmd (__fish_git_needs_command)
743    set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
744    if set -q $varname
745        echo -- $$varname | read -lat toks
746        set toks (string replace -r '(-.*)=.*' '' -- $toks)
747        for i in $argv
748            if contains -- --$i $toks
749                return 0
750            end
751        end
752
753        for i in $_flag_s
754            if string match -qr -- "^-$i|^-[^-]*$i" $toks
755                return 0
756            end
757        end
758    end
759
760    return 1
761end
762function __fish_git_stash_using_command
763    set -l cmd (commandline -xpc)
764    __fish_git_using_command stash
765    or return 2
766    # The word after the stash command _must_ be the subcommand
767    set cmd $cmd[(contains -i -- "stash" $cmd)..-1]
768    set -e cmd[1]
769    set -q cmd[1]
770    or return 1
771    contains -- $cmd[1] $argv
772    and return 0
773    return 1
774end
775
776function __fish_git_stash_not_using_subcommand
777    set -l cmd (commandline -xpc)
778    __fish_git_using_command stash
779    or return 2
780    set cmd $cmd[(contains -i -- "stash" $cmd)..-1]
781    set -q cmd[2]
782    or return 0
783    contains -- $cmd[2] list show pop apply clear drop create save branch push
784    and return 1
785    return 0
786end
787
788function __fish_git_stash_is_push
789    __fish_git_stash_not_using_subcommand
790    or __fish_git_stash_using_command push
791end
792
793function __fish_git_complete_worktrees
794    __fish_git worktree list --porcelain | string replace --regex --filter '^worktree\s*' ''
795end
796
797function __fish_git_complete_stashes
798    __fish_git stash list --format=%gd:%gs 2>/dev/null | string replace ":" \t
799end
800
801function __fish_git_aliases
802    __fish_git config -z --get-regexp '^alias\.' 2>/dev/null | while read -lz key value
803        begin
804            set -l name (string replace -r '^.*\.' '' -- $key)
805            set -l val (string shorten --no-newline -m 36 -- $value)
806            printf "%s\t%s\n" $name "alias: $val"
807        end
808    end
809end
810
811function __fish_git_custom_commands
812    # complete all commands starting with git-
813    # however, a few builtin commands are placed into $PATH by git because
814    # they're used by the ssh transport. We could filter them out by checking
815    # if any of these completion results match the name of the builtin git commands,
816    # but it's simpler just to blacklist these names. They're unlikely to change,
817    # and the failure mode is we accidentally complete a plumbing command.
818    set -l git_subcommands $PATH/git-*
819    for name in (string replace -r "^.*/git-([^/]*)" '$1' $git_subcommands)
820        switch $name
821            case cvsserver receive-pack shell upload-archive upload-pack
822                # skip these
823            case \*
824                echo $name
825        end
826    end
827end
828
829# Suggest branches for the specified remote - returns 1 if no known remote is specified
830function __fish_git_branch_for_remote
831    set -l remotes (__fish_git remote 2>/dev/null)
832    set -l remote
833    set -l cmd (commandline -xpc)
834    for r in $remotes
835        if contains -- $r $cmd
836            set remote $r
837            break
838        end
839    end
840    set -q remote[1]
841    or return 1
842    __fish_git_branches | string replace -f -- "$remote/" ''
843end
844
845# Return 0 if the current token is a possible commit-hash with at least 3 characters
846function __fish_git_possible_commithash
847    set -q argv[1]
848    and set -l token $argv[1]
849    or set -l token (commandline -ct)
850    if string match -qr '^[0-9a-fA-F]{3,}$' -- $token
851        return 0
852    end
853    return 1
854end
855
856function __fish_git_reflog
857    __fish_git reflog --no-decorate 2>/dev/null | string replace -r '[0-9a-f]* (.+@\{[0-9]+\}): (.*)$' '$1\t$2'
858end
859
860function __fish_git_help_all_concepts
861    git help -g | string match -e -r '^   \w+' | while read -l concept desc
862        printf "%s\tConcept: %s\n" $concept (string trim $desc)
863    end
864end
865
866function __fish_git_diff_opt -a option
867    switch $option
868        case diff-algorithm
869            printf "%b" "
870default\tBasic greedy diff algorithm
871myers\tBasic greedy diff algorithm
872minimal\tMake smallest diff possible
873patience\tPatience diff algorithm
874histogram\tPatience algorithm with low-occurrence common elements"
875        case diff-filter
876            printf "%b" "
877A\tAdded files
878C\tCopied files
879D\tDeleted files
880M\tModified files
881R\tRenamed files
882T\tType changed files
883U\tUnmerged files
884X\tUnknown files
885B\tBroken pairing files"
886        case dirstat
887            printf "%b" "
888changes\tCount lines that have been removed from the source / added to the destination
889lines\tRegular line-based diff analysis
890files\tCount the number of files changed
891cumulative\tCount changes in a child directory for the parent directory as well"
892        case ignore-submodules
893            printf "%b" "
894none\tUntracked/modified files
895untracked\tNot considered dirty when they only contain untracked content
896dirty\tIgnore all changes to the work tree of submodules
897all\tHide all changes to submodules (default)"
898        case submodule
899            printf "%b" "
900short\tShow the name of the commits at the beginning and end of the range
901log\tList the commits in the range
902diff\tShow an inline diff of the changes"
903        case ws-error-highlight
904            printf "%b" "
905context\tcontext lines of the diff
906old\told lines of the diff
907new\tnew lines of the diff
908none\treset previous values
909default\treset the list to 'new'
910all\tShorthand for 'old,new,context'"
911    end
912end
913
914function __fish_git_show_opt -a option
915    switch $option
916        case format pretty
917            printf "%b" "
918oneline\t<sha1> <title line>
919short\t<sha1> / <author> / <title line>
920medium\t<sha1> / <author> / <author date> / <title> / <commit msg>
921full\t<sha1> / <author> / <committer> / <title> / <commit msg>
922fuller\t<sha1> / <author> / <author date> / <committer> / <committer date> / <title> / <commit msg>
923reference\t<abbrev-hash> (<title-line>, <short-author-date>)
924email\t<sha1> <date> / <author> / <author date> / <title> / <commit msg>
925mboxrd\tLike email, but lines in the commit message starting with \"From \" are quoted with \">\"
926raw\tShow the entire commit exactly as stored in the commit object
927format:\tSpecify which information to show
928"
929            __fish_git config -z --get-regexp '^pretty\.' 2>/dev/null | while read -lz key value
930                set -l name (string replace -r '^.*?\.' '' -- $key)
931                printf "%s\t%s\n" $name $value
932            end
933    end
934end
935
936function __fish_git_is_rebasing
937    test -e (__fish_git rev-parse --absolute-git-dir)/rebase-merge
938end
939
940function __fish_git_filters
941    printf "%s\n" \
942        blob:none\t"omits all blobs" \
943        blob:limit=\t"omits blobs by size" \
944        object:type={tag,commit,tree,blob}\t"omit object which are not of the requested type" \
945        sparse:oid=\t"omit blobs not required for a sparse checkout" \
946        tree:\t"omits all blobs and trees"
947end
948
949# general options
950complete git -f -l help -s h -d 'Display manual of a Git command'
951complete git -f -n __fish_git_needs_command -l version -s v -d 'display git version'
952complete git -x -n __fish_git_needs_command -s C -a '(__fish_complete_directories)' -d 'run as if started in dir'
953complete git -x -n __fish_git_needs_command -s c -a '(__fish_git config -l 2>/dev/null | string replace = \t)' -d 'set config option (conf-key=val)'
954complete git -x -n __fish_git_needs_command -l config-env -a '(__fish_git config -l 2>/dev/null | string replace = \t)' -d 'like -c but environment var (conf-key=ENVVAR)'
955complete git -x -n __fish_git_needs_command -l exec-path -a '(__fish_complete_directories)' -d 'get or set the path to git'
956complete git -f -n __fish_git_needs_command -l html-path -d 'print html docs path'
957complete git -f -n __fish_git_needs_command -l man-path -d 'print man pages path'
958complete git -f -n __fish_git_needs_command -l info-path -d 'print info docs path'
959complete git -f -n __fish_git_needs_command -s p -l paginate -d 'pipe output into pager'
960complete git -f -n __fish_git_needs_command -s P -l no-pager -d 'don\'t pipe output into pager'
961complete git -r -n __fish_git_needs_command -l git-dir -d 'set path to the repo'
962complete git -r -n __fish_git_needs_command -l work-tree -d 'set path to the working tree'
963complete git -f -n __fish_git_needs_command -l namespace -d 'set Git namespace'
964complete git -f -n __fish_git_needs_command -l bare -d 'treat the repo as bare'
965complete git -f -n __fish_git_needs_command -l no-replace-objects -d 'disable replacement references'
966complete git -f -n __fish_git_needs_command -l literal-pathspecs -d 'treat pathspecs literally'
967complete git -f -n __fish_git_needs_command -l glob-pathspecs -d 'treat pathspecs as globs'
968complete git -f -n __fish_git_needs_command -l noglob-pathspecs -d 'don\'t treat pathspecs as globs'
969complete git -f -n __fish_git_needs_command -l icase-pathspecs -d 'match pathspecs case-insensitively'
970complete git -f -n __fish_git_needs_command -l no-optional-locks -d 'skip optional operations requiring locks'
971complete git -x -n __fish_git_needs_command -l list-cmds -d 'list commands by group' -k -a "builtins\t
972parseopt\t'builtins using parse-options'
973others\t'git- commands in \$PATH'
974nohelpers\t'exclude helper commands'
975config\t'list completion.commands'"
976
977# Options shared between multiple commands
978complete -f -c git -n '__fish_git_using_command log show diff-tree rev-list' -l pretty -a '(__fish_git_show_opt pretty)'
979
980complete -c git -n '__fish_git_using_command diff show range-diff' -l abbrev -d 'Show only a partial prefix instead of the full 40-byte hexadecimal object name'
981complete -c git -n '__fish_git_using_command diff show range-diff' -l binary -d 'Output a binary diff that can be applied with "git-apply"'
982complete -c git -n '__fish_git_using_command diff show range-diff' -l check -d 'Warn if changes introduce conflict markers or whitespace errors'
983complete -c git -n '__fish_git_using_command diff show range-diff' -l color -d 'Show colored diff'
984complete -x -c git -n '__fish_git_using_command diff show range-diff' -l color-moved -d 'Moved lines of code are colored differently' -a 'no default plain blocks zebra dimmed-zebra'
985complete -x -c git -n '__fish_git_using_command diff show range-diff' -l color-moved-ws -d 'Ignore whitespace when using --color-moved' -a 'no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change'
986complete -c git -n '__fish_git_using_command diff show range-diff' -l color-words -d 'Equivalent to --word-diff=color plus --word-diff-regex=<regex>'
987complete -c git -n '__fish_git_using_command diff show range-diff' -l compact-summary -d 'Output a condensed summary of extended header information'
988complete -c git -n '__fish_git_using_command diff log show range-diff' -l dst-prefix -d 'Show the given destination prefix instead of "b/"'
989complete -c git -n '__fish_git_using_command diff show range-diff' -l ext-diff -d 'Allow an external diff helper to be executed'
990complete -c git -n '__fish_git_using_command diff show range-diff' -l find-copies-harder -d 'Inspect unmodified files as candidates for the source of copy'
991complete -c git -n '__fish_git_using_command diff show range-diff' -l find-object -d 'Look for differences that change the number of occurrences of the object'
992complete -c git -n '__fish_git_using_command diff show range-diff' -l full-index -d 'Show the full pre- and post-image blob object names on the "index" line'
993complete -c git -n '__fish_git_using_command diff show range-diff' -l histogram -d 'Generate a diff using the "histogram diff" algorithm'
994complete -c git -n '__fish_git_using_command diff show range-diff' -l ignore-blank-lines -d 'Ignore changes whose lines are all blank'
995complete -c git -n '__fish_git_using_command diff show range-diff' -l ignore-cr-at-eol -d 'Ignore carriage-return at the end of line when doing a comparison'
996complete -c git -n '__fish_git_using_command diff show range-diff' -l ignore-space-at-eol -d 'Ignore changes in whitespace at EOL'
997complete -c git -n '__fish_git_using_command diff show range-diff' -l indent-heuristic -d 'Enable the heuristic that shift diff hunk boundaries'
998complete -c git -n '__fish_git_using_command diff log show range-diff' -l inter-hunk-context -d 'Show the context between diff hunks, up to the specified number of lines'
999complete -c git -n '__fish_git_using_command diff log show range-diff' -l ita-invisible-in-index -d 'Make the entry appear as a new file in "git diff" and non-existent in "git diff -l cached"'
1000complete -c git -n '__fish_git_using_command diff log show range-diff' -l line-prefix -d 'Prepend an additional prefix to every line of output'
1001complete -c git -n '__fish_git_using_command diff show range-diff' -l minimal -d 'Spend extra time to make sure the smallest possible diff is produced'
1002complete -c git -n '__fish_git_using_command diff show range-diff' -l name-only -d 'Show only names of changed files'
1003complete -c git -n '__fish_git_using_command diff show range-diff' -l name-status -d 'Show only names and status of changed files'
1004complete -c git -n '__fish_git_using_command diff show range-diff' -l no-color -d 'Turn off colored diff'
1005complete -c git -n '__fish_git_using_command diff show range-diff' -l no-ext-diff -d 'Disallow external diff drivers'
1006complete -c git -n '__fish_git_using_command diff show range-diff' -l no-indent-heuristic -d 'Disable the indent heuristic'
1007complete -c git -n '__fish_git_using_command diff log show range-diff' -l no-prefix -d 'Do not show any source or destination prefix'
1008complete -c git -n '__fish_git_using_command diff show range-diff' -l no-renames -d 'Turn off rename detection'
1009complete -c git -n '__fish_git_using_command diff show range-diff' -l no-textconv -d 'Disallow external text conversion filters to be run when comparing binary files'
1010complete -c git -n '__fish_git_using_command diff show range-diff' -l numstat -d 'Shows number of added/deleted lines in decimal notation'
1011complete -c git -n '__fish_git_using_command diff show range-diff' -l patch-with-raw -d 'Synonym for -p --raw'
1012complete -c git -n '__fish_git_using_command diff show range-diff' -l patch-with-stat -d 'Synonym for -p --stat'
1013complete -c git -n '__fish_git_using_command diff show range-diff' -l patience -d 'Generate a diff using the "patience diff" algorithm'
1014complete -c git -n '__fish_git_using_command diff log show range-diff' -l pickaxe-all -d 'When -S or -G finds a change, show all the changes in that changeset'
1015complete -c git -n '__fish_git_using_command diff log show range-diff' -l pickaxe-regex -d 'Treat the <string> given to -S as an extended POSIX regular expression to match'
1016complete -c git -n '__fish_git_using_command diff log show range-diff' -l relative -d 'Exclude changes outside the directory and show relative pathnames'
1017complete -c git -n '__fish_git_using_command diff show range-diff' -l shortstat -d 'Output only the last line of the --stat format containing the total'
1018complete -c git -n '__fish_git_using_command diff log show range-diff' -l src-prefix -d 'Show the given source prefix instead of "a/"'
1019complete -c git -n '__fish_git_using_command diff show range-diff' -l stat -d 'Generate a diffstat'
1020complete -c git -n '__fish_git_using_command diff show range-diff apply' -l stat -d 'Generate a diffstat'
1021complete -c git -n '__fish_git_using_command diff show range-diff' -l summary -d 'Output a condensed summary of extended header information'
1022complete -c git -n '__fish_git_using_command diff show range-diff' -l textconv -d 'Allow external text conversion filters to be run when comparing binary files'
1023complete -c git -n '__fish_git_using_command diff show range-diff' -l word-diff -d 'Show a word diff'
1024complete -c git -n '__fish_git_using_command diff show range-diff' -l word-diff-regex -d 'Use <regex> to decide what a word is'
1025complete -c git -n '__fish_git_using_command diff log show range-diff' -s a -l text -d 'Treat all files as text'
1026complete -c git -n '__fish_git_using_command diff log show range-diff' -s B -l break-rewrites -d 'Break complete rewrite changes into pairs of delete and create'
1027complete -c git -n '__fish_git_using_command diff show range-diff' -s b -l ignore-space-change -d 'Ignore changes in amount of whitespace'
1028complete -c git -n '__fish_git_using_command diff log show range-diff' -s C -l find-copies -d 'Detect copies as well as renames'
1029complete -c git -n '__fish_git_using_command diff log show range-diff' -s D -l irreversible-delete -d 'Omit the preimage for deletes'
1030complete -c git -n '__fish_git_using_command diff log show range-diff' -s G -d "Look for differences where <regex> matches the patch's added/removed lines"
1031complete -c git -n '__fish_git_using_command diff log show range-diff' -s M -l find-renames -d 'Detect and report renames'
1032complete -c git -n '__fish_git_using_command diff log show range-diff' -s R -d 'Swap inputs to create a reverse diff'
1033complete -c git -n '__fish_git_using_command diff log show range-diff' -s S -d 'Look for differences that change the number of occurrences of the string'
1034complete -c git -n '__fish_git_using_command diff show range-diff' -s W -l function-context -d 'Show whole surrounding functions of changes'
1035complete -c git -n '__fish_git_using_command diff show range-diff' -s w -l ignore-all-space -d 'Ignore whitespace when comparing lines'
1036complete -c git -n '__fish_git_using_command diff show range-diff' -s z -d 'Use NULs as output field/commit terminators'
1037complete -r -c git -n '__fish_git_using_command diff log show range-diff' -s O -d 'Control the order in which files appear in the output'
1038complete -f -c git -n '__fish_git_using_command diff show range-diff' -l anchored -d 'Generate a diff using the "anchored diff" algorithm'
1039complete -x -c git -n '__fish_git_using_command diff log show range-diff' -s l -d 'Prevents rename/copy detection when rename/copy targets exceed the given number'
1040complete -x -c git -n '__fish_git_using_command diff show range-diff' -l diff-filter -a '(__fish_git_diff_opt diff-filter)' -d 'Choose diff filters'
1041complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l diff-algorithm -a '(__fish_git_diff_opt diff-algorithm)' -d 'Choose a diff algorithm'
1042complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l dirstat -a '(__fish_git_diff_opt dirstat)' -d 'Output the distribution of relative amount of changes for each sub-directory'
1043complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ignore-submodules -a '(__fish_git_diff_opt ignore-submodules)' -d 'Ignore changes to submodules in the diff generation'
1044complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l submodule -a '(__fish_git_diff_opt submodule)' -d 'Specify how differences in submodules are shown'
1045complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ws-error-highlight -a '(__fish_git_diff_opt ws-error-highlight)' -d 'Highlight whitespace errors in lines of the diff'
1046
1047complete -f -c git -n '__fish_git_using_command fetch pull' -l unshallow -d 'Convert a shallow repository to a complete one'
1048complete -f -c git -n '__fish_git_using_command fetch pull' -l set-upstream -d 'Add upstream (tracking) reference'
1049
1050complete -x -c git -n '__fish_git_using_command fetch pull' -l recurse-submodules -a 'yes on-demand no' -d 'Recursively fetch submodules'
1051complete -f -c git -n '__fish_git_using_command fetch pull' -l no-recurse-submodules -d 'Do not recursively fetch submodules'
1052
1053#### fetch
1054complete -f -c git -n __fish_git_needs_command -a fetch -d 'Download objects from another repo'
1055# Suggest "repository", then "refspec" - this also applies to e.g. push/pull
1056complete -f -c git -n '__fish_git_using_command fetch' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d Remote
1057complete -f -c git -n '__fish_git_using_command fetch' -n __fish_git_branch_for_remote -ka '(__fish_git_branch_for_remote)'
1058complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be more quiet'
1059complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be more verbose'
1060complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append to .git/FETCH_HEAD instead of overwriting'
1061complete -f -c git -n '__fish_git_using_command fetch' -l upload-pack -d 'Path to upload pack on remote end'
1062complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches'
1063complete -f -c git -n '__fish_git_using_command fetch' -s p -l prune -d 'Prune remote-tracking branches no longer on remote'
1064complete -f -c git -n '__fish_git_using_command fetch' -l all -d 'Fetch all remotes'
1065complete -f -c git -n '__fish_git_using_command fetch' -l atomic -d 'Use atomic transfer to update references'
1066complete -f -c git -n '__fish_git_using_command fetch' -s m -l multiple -d 'Fetch from multiple remotes'
1067complete -f -c git -n '__fish_git_using_command fetch' -s t -l tags -d 'Fetch all tags and associated objects'
1068complete -f -c git -n '__fish_git_using_command fetch' -s P -l prune-tags -d 'Prune local tags no longer on remote and clobber changed tags'
1069complete -f -c git -n '__fish_git_using_command fetch' -l prefetch -d 'Modify the refspec to replace all refs within refs/prefetch/'
1070complete -f -c git -n '__fish_git_using_command fetch' -s j -l jobs -d 'Numbers of submodules fetched in parallel'
1071complete -f -c git -n '__fish_git_using_command fetch' -s n -d 'Do not fetch all tags (--no-tags)'
1072complete -f -c git -n '__fish_git_using_command fetch' -l dry-run -d 'Dry run'
1073complete -f -c git -n '__fish_git_using_command fetch' -l depth -d 'Limit number of commits'
1074complete -f -c git -n '__fish_git_using_command fetch' -l with-fetch-head -d 'Write fetched references to the FETCH_HEAD file'
1075complete -f -c git -n '__fish_git_using_command fetch' -l update-shallow -d 'Accept refs that update .git/shallow'
1076complete -f -c git -n '__fish_git_using_command fetch' -s k -l keep -d 'Keep downloaded pack'
1077complete -f -c git -n '__fish_git_using_command fetch' -s u -l update-head-ok -d 'Allow updating of HEAD ref'
1078complete -f -c git -n '__fish_git_using_command fetch' -l progress -d 'Force progress reporting'
1079complete -f -c git -n '__fish_git_using_command fetch' -l deepen -d 'Deepen history of shallow clones'
1080complete -f -c git -n '__fish_git_using_command fetch' -l shallow-since -d 'Deepen history of shallow repository based on time'
1081complete -f -c git -n '__fish_git_using_command fetch' -l shallow-exclude -d 'Deepen history of shallow clone, excluding rev'
1082complete -f -c git -n '__fish_git_using_command fetch' -l unshallow -d 'Convert to a complete repository'
1083complete -f -c git -n '__fish_git_using_command fetch' -l refetch -d 'Re-fetch without negotiating common commits'
1084__fish_git_add_revision_completion -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -x
1085complete -f -c git -n '__fish_git_using_command fetch' -l negotiate-only -d "Don't fetch, only show commits in common with the server"
1086complete -f -c git -n '__fish_git_using_command fetch' -l filter -ra '(__fish_git_filters)' -d 'Request a subset of objects from server'
1087complete -f -c git -n '__fish_git_using_command fetch' -s 4 -l ipv4 -d 'Use IPv4 addresses only'
1088complete -f -c git -n '__fish_git_using_command fetch' -s 6 -l ipv6 -d 'Use IPv6 addresses only'
1089complete -x -c git -n '__fish_git_using_command fetch' -l depth -d 'Limit fetching to specified depth'
1090complete -x -c git -n '__fish_git_using_command fetch' -l deepen -d 'Deepen history of shallow repository'
1091complete -x -c git -n '__fish_git_using_command fetch' -l shallow-since -d 'Deepen history after specified date'
1092complete -x -c git -n '__fish_git_using_command fetch' -l shallow-exclude -d 'Deepen history excluding branch'
1093complete -f -c git -n '__fish_git_using_command fetch' -l unshallow -d 'Convert shallow repository to complete one'
1094complete -f -c git -n '__fish_git_using_command fetch' -l update-shallow -d 'Accept refs that update .git/shallow'
1095complete -x -c git -n '__fish_git_using_command fetch' -l refmap -d 'Specify refspec to map the refs to remote-tracking branches'
1096complete -f -c git -n '__fish_git_using_command fetch' -l write-fetch-head -d 'Write FETCH_HEAD file (default)'
1097complete -f -c git -n '__fish_git_using_command fetch' -l no-write-fetch-head -d 'Do not write FETCH_HEAD file'
1098
1099#### filter-branch
1100complete -f -c git -n __fish_git_needs_command -a filter-branch -d 'Rewrite branches'
1101complete -f -c git -n '__fish_git_using_command filter-branch' -l env-filter -d 'Filter for rewriting env vars like author name/email'
1102complete -f -c git -n '__fish_git_using_command filter-branch' -l tree-filter -d 'Filter for rewriting the tree and its contents'
1103complete -f -c git -n '__fish_git_using_command filter-branch' -l index-filter -d 'Filter for rewriting the index'
1104complete -f -c git -n '__fish_git_using_command filter-branch' -l parent-filter -d 'Filter for rewriting the commit'
1105complete -f -c git -n '__fish_git_using_command filter-branch' -l msg-filter -d 'Filter for rewriting the commit messages'
1106complete -f -c git -n '__fish_git_using_command filter-branch' -l commit-filter -d 'Filter for performing the commit'
1107complete -f -c git -n '__fish_git_using_command filter-branch' -l tag-name-filter -d 'Filter for rewriting tag names'
1108complete -f -c git -n '__fish_git_using_command filter-branch' -l subdirectory-filter -d 'Only look at the history which touches the given subdirectory'
1109complete -f -c git -n '__fish_git_using_command filter-branch' -l prune-empty -d 'Ignore empty commits generated by filters'
1110complete -f -c git -n '__fish_git_using_command filter-branch' -l original -d 'Use this option to set the namespace where the original commits will be stored'
1111complete -r -c git -n '__fish_git_using_command filter-branch' -s d -d 'Use this option to set the path to the temporary directory used for rewriting'
1112complete -c git -n '__fish_git_using_command filter-branch' -s f -l force -d 'Filter even with refs in refs/original or existing temp directory'
1113
1114### remote
1115set -l remotecommands add rm remove show prune update rename set-head set-url set-branches get-url
1116complete -f -c git -n __fish_git_needs_command -a remote -d 'Manage tracked repositories'
1117complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from $remotecommands" -a '(__fish_git_remotes)'
1118complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -s v -l verbose -d 'Be verbose'
1119complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a add -d 'Adds a new remote'
1120complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a rm -d 'Removes a remote'
1121complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a remove -d 'Removes a remote'
1122complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a show -d 'Shows a remote'
1123complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a prune -d 'Deletes all stale tracking branches'
1124complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a update -d 'Fetches updates'
1125complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a rename -d 'Renames a remote'
1126complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-head -d 'Sets the default branch for a remote'
1127complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-url -d 'Changes URLs for a remote'
1128complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a get-url -d 'Retrieves URLs for a remote'
1129complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-branches -d 'Changes the list of branches tracked by a remote'
1130complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -s f -d 'Once the remote information is set up git fetch <name> is run'
1131complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -l tags -d 'Import every tag from a remote with git fetch <name>'
1132complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -l no-tags -d "Don't import tags from a remote with git fetch <name>"
1133complete -f -c git -n '__fish_git_using_command remote' -n '__fish_seen_subcommand_from remove' -xa '(__fish_git_remotes)'
1134complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-branches" -l add -d 'Add to the list of currently tracked branches instead of replacing it'
1135complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l push -d 'Manipulate push URLs instead of fetch URLs'
1136complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l add -d 'Add new URL instead of changing the existing URLs'
1137complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l delete -d 'Remove URLs that match specified URL'
1138complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from get-url" -l push -d 'Query push URLs rather than fetch URLs'
1139complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from get-url" -l all -d 'All URLs for the remote will be listed'
1140complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from show" -s n -d 'Remote heads are not queried, cached information is used instead'
1141complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from prune" -l dry-run -d 'Report what will be pruned but do not actually prune it'
1142complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from update" -l prune -d 'Prune all remotes that are updated'
1143
1144### show
1145complete -f -c git -n __fish_git_needs_command -a show -d 'Show the last commit of a branch'
1146complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
1147__fish_git_add_revision_completion -n '__fish_git_using_command show'
1148complete -f -c git -n __fish_git_needs_rev_files -n 'not contains -- -- (commandline -xpc)' -xa '(__fish_git_complete_rev_files)'
1149complete -F -c git -n '__fish_git_using_command show' -n 'contains -- -- (commandline -xpc)'
1150complete -f -c git -n '__fish_git_using_command show' -l format -d 'Pretty-print the contents of the commit logs in a given format' -a '(__fish_git_show_opt format)'
1151complete -f -c git -n '__fish_git_using_command show' -l abbrev-commit -d 'Show only a partial hexadecimal commit object name'
1152complete -f -c git -n '__fish_git_using_command show' -l no-abbrev-commit -d 'Show the full 40-byte hexadecimal commit object name'
1153complete -f -c git -n '__fish_git_using_command show' -l oneline -d 'Shorthand for "--pretty=oneline --abbrev-commit"'
1154complete -f -c git -n '__fish_git_using_command show' -l encoding -d 'Re-code the commit log message in the encoding'
1155complete -f -c git -n '__fish_git_using_command show' -l expand-tabs -d 'Perform a tab expansion in the log message'
1156complete -f -c git -n '__fish_git_using_command show' -l no-expand-tabs -d 'Do not perform a tab expansion in the log message'
1157complete -f -c git -n '__fish_git_using_command show' -l notes -ka '(__fish_git_refs)' -d 'Show the notes that annotate the commit'
1158complete -f -c git -n '__fish_git_using_command show' -l no-notes -d 'Do not show notes'
1159complete -f -c git -n '__fish_git_using_command show' -s s -l no-patch -d 'Suppress diff output'
1160complete -f -c git -n '__fish_git_using_command show' -l show-signature -d 'Check the validity of a signed commit object'
1161
1162### show-branch
1163complete -f -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a show-branch -d 'Show the commits on branches'
1164complete -f -c git -n '__fish_git_using_command show-branch' -ka '(__fish_git_refs)' -d Rev
1165complete -f -c git -n '__fish_git_using_command show-branch' -s r -l remotes -d "Shows the remote tracking branches"
1166complete -f -c git -n '__fish_git_using_command show-branch' -s a -l all -d "Show both remote-tracking branches and local branches"
1167complete -f -c git -n '__fish_git_using_command show-branch' -l current -d "Includes the current branch to the list of revs to be shown"
1168complete -f -c git -n '__fish_git_using_command show-branch' -l topo-order -d "Makes commits appear in topological order"
1169complete -f -c git -n '__fish_git_using_command show-branch' -l date-order -d "Makes commits appear in date order"
1170complete -f -c git -n '__fish_git_using_command show-branch' -l sparse -d "Shows merges only reachable from one tip"
1171complete -f -c git -n '__fish_git_using_command show-branch' -l no-name -d "Do not show naming strings for each commit"
1172complete -f -c git -n '__fish_git_using_command show-branch' -l sha1-name -d "Name commits with unique prefix"
1173complete -f -c git -n '__fish_git_using_command show-branch' -l no-color -d "Turn off colored output"
1174complete -f -c git -n '__fish_git_using_command show-branch' -l merge-base -d "Determine merge bases for the given commits"
1175complete -f -c git -n '__fish_git_using_command show-branch' -l independent -d "Show which refs can't be reached from any other"
1176complete -f -c git -n '__fish_git_using_command show-branch' -l topics -d "Show only commits that are not on the first given branch"
1177complete -f -c git -n '__fish_git_using_command show-branch' -l all -d 'Show all refs under refs/heads and refs/remotes'
1178complete -f -c git -n '__fish_git_using_command show-branch' -s r -l remotes -d 'Show all refs under refs/remotes'
1179complete -f -c git -n '__fish_git_using_command show-branch' -l current -d 'Include the current branch to the list of revs'
1180complete -f -c git -n '__fish_git_using_command show-branch' -l topo-order -d 'Do not show commits in reverse chronological order'
1181complete -f -c git -n '__fish_git_using_command show-branch' -l date-order -d 'Show commits in chronological order'
1182complete -f -c git -n '__fish_git_using_command show-branch' -l sparse -d 'Show merges only reachable from one tip'
1183complete -x -c git -n '__fish_git_using_command show-branch' -l more -d 'Go N more commits beyond common ancestor'
1184complete -f -c git -n '__fish_git_using_command show-branch' -l list -d 'Show branches and their commits'
1185complete -f -c git -n '__fish_git_using_command show-branch' -l sha1-name -d 'Name commits with unique prefix of SHA-1'
1186complete -f -c git -n '__fish_git_using_command show-branch' -l no-name -d 'Do not show naming strings for each commit'
1187complete -x -c git -n '__fish_git_using_command show-branch' -l color -a 'always never auto' -d 'Color the status sign'
1188complete -f -c git -n '__fish_git_using_command show-branch' -l no-color -d 'Turn off colored output'
1189
1190### add
1191complete -c git -n __fish_git_needs_command -a add -d 'Add file contents to the staging area'
1192complete -c git -n '__fish_git_using_command add' -s n -l dry-run -d "Don't actually add the file(s)"
1193complete -c git -n '__fish_git_using_command add' -s v -l verbose -d 'Be verbose'
1194complete -c git -n '__fish_git_using_command add' -s f -l force -d 'Allow adding otherwise ignored files'
1195complete -c git -n '__fish_git_using_command add' -s i -l interactive -d 'Interactive mode'
1196complete -c git -n '__fish_git_using_command add' -s p -l patch -d 'Interactively choose hunks to stage'
1197complete -c git -n '__fish_git_using_command add' -s e -l edit -d 'Manually create a patch'
1198complete -c git -n '__fish_git_using_command add' -s u -l update -d 'Only match tracked files'
1199complete -c git -n '__fish_git_using_command add' -s A -l all -d 'Match files both in working tree and index'
1200complete -c git -n '__fish_git_using_command add' -s N -l intent-to-add -d 'Record only the fact that the path will be added later'
1201complete -c git -n '__fish_git_using_command add' -l refresh -d "Don't add the file(s), but only refresh their stat"
1202complete -c git -n '__fish_git_using_command add' -l chmod -xa "-x\t'Track file as non-executable' +x\t'Track file as executable'"
1203complete -c git -n '__fish_git_using_command add' -l ignore-errors -d 'Ignore errors'
1204complete -c git -n '__fish_git_using_command add' -l ignore-missing -d 'Check if any of the given files would be ignored'
1205# Renames also show up as untracked + deleted, and to get git to show it as a rename _both_ need to be added.
1206# However, we can't do that as it is two tokens, so we don't need renamed here.
1207complete -f -c git -n '__fish_git_using_command add; and test "$(__fish_git config --type bool --get status.showUntrackedFiles)" != false' -a '(__fish_git_files modified untracked deleted unmerged modified-staged-deleted)'
1208# If we have so many files that you disable untrackedfiles, let's add file completions,
1209# to avoid slurping megabytes of git output.
1210complete -F -c git -n '__fish_git_using_command add; and test "$(__fish_git config --type bool --get status.showUntrackedFiles)" = false' -a '(__fish_git_files modified deleted unmerged modified-staged-deleted)'
1211
1212### am
1213complete -c git -n __fish_git_needs_command -a am -d 'Apply patches from a mailbox'
1214complete -f -c git -n '__fish_git_using_command am' -s s -l signoff -d 'Add a Signed-off-By trailer to commit message'
1215complete -f -c git -n '__fish_git_using_command am' -l keep-non-patch -d 'Only strip bracket pairs containing \'PATCH\''
1216complete -f -c git -n '__fish_git_using_command am' -l no-keep-cr -d 'Override am.keepcr to false'
1217complete -f -c git -n '__fish_git_using_command am' -s c -l scissors -d 'Remove everything in body before scissors'
1218complete -f -c git -n '__fish_git_using_command am' -l no-scissors -d 'Ignore scissor lines'
1219complete -x -c git -n '__fish_git_using_command am' -l quoted-cr -a 'nowarn warn strip' -d 'What to do when an email ends with CRLF'
1220complete -f -c git -n '__fish_git_using_command am' -l no-messageid -d 'Do not add message id to commit message'
1221complete -f -c git -n '__fish_git_using_command am' -s q -l quiet -d 'Suppress logs'
1222complete -f -c git -n '__fish_git_using_command am' -l no-utf8 -d 'Disable all charset re-encoding of metadata'
1223complete -f -c git -n '__fish_git_using_command am' -s 3 -l 3way -d 'Fall back to three way merge on patch failure'
1224complete -f -c git -n '__fish_git_using_command am' -l no-3way -d 'Do not fall back to three way merge on patch failure'
1225complete -f -c git -n '__fish_git_using_command am' -l rerere-autoupdate -d 'Allow rerere to update index if possible'
1226complete -f -c git -n '__fish_git_using_command am' -l ignore-space-change -d 'Pass --ignore-space-change to git apply'
1227complete -F -c git -n '__fish_git_using_command am' -l directory -d 'Pass --directory to git apply'
1228complete -F -c git -n '__fish_git_using_command am' -l exclude -d 'Pass --exclude to git apply'
1229complete -F -c git -n '__fish_git_using_command am' -l include -d 'Pass --include to git apply'
1230complete -f -c git -n '__fish_git_using_command am' -l reject -d 'Pass --reject to git apply'
1231complete -x -f git -n '__fish_git_using_command am' -l patch-format -a 'mbox mboxrd stgit stgit-series hg' -d 'Specify the patch format'
1232complete -f -c git -n '__fish_git_using_command am' -s i -l interactive -d 'Run interactively'
1233complete -f -c git -n '__fish_git_using_command am' -l committer-date-is-author-date -d 'Treat committer date as author date'
1234complete -f -c git -n '__fish_git_using_command am' -l ignore-date -d 'Treat author date as committer date'
1235complete -f -c git -n '__fish_git_using_command am' -l skip -d 'Skip current patch'
1236complete -x -c git -n '__fish_git_using_command am' -s S -l gpg-sign -a '(type -q gpg && __fish_complete_gpg_key_id gpg)' -d 'Sign commits with gpg'
1237complete -f -c git -n '__fish_git_using_command am' -l no-gpg-sign -d 'Do not sign commits'
1238complete -f -c git -n '__fish_git_using_command am' -s n -l no-verify -d 'Do not run pre-applypatch and applypatch-msg hooks'
1239complete -f -c git -n '__fish_git_using_command am' -s r -l resolved -l continue -d 'Mark patch failures as resolved'
1240complete -x -c git -n '__fish_git_using_command am' -l resolvemsg -d 'Message to print after patch failure'
1241complete -f -c git -n '__fish_git_using_command am' -l abort -d 'Abort patch operation and restore branch'
1242complete -f -c git -n '__fish_git_using_command am' -l quit -d 'Abort without restoring branch'
1243complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff raw' -d 'Show message at which patch failures occurred'
1244
1245### checkout
1246complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -xpc)'
1247complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
1248begin
1249    set -lx __fish_git_recent_commits_arg --all
1250    set -lx __fish_git_unqualified_unique_remote_branches true
1251    __fish_git_add_revision_completion -n '__fish_git_using_command checkout'
1252end
1253
1254# In the presence of changed files, `git checkout ...` assumes highest likelihood is intent to restore so this comes last (aka shown first).
1255complete -f -c git -n '__fish_git_using_command checkout' -ka '(__fish_git_files modified deleted modified-staged-deleted)'
1256
1257complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
1258complete -f -c git -n '__fish_git_using_command checkout' -s B -d 'Create a new branch or reset existing to start point'
1259complete -f -c git -n '__fish_git_using_command checkout' -s t -l track -d 'Track a new branch'
1260complete -f -c git -n '__fish_git_using_command checkout' -l theirs -d 'Keep staged changes'
1261complete -f -c git -n '__fish_git_using_command checkout' -l ours -d 'Keep unmerged changes'
1262complete -f -c git -n '__fish_git_using_command checkout' -l recurse-submodules -d 'Update the work trees of submodules'
1263complete -f -c git -n '__fish_git_using_command checkout' -l no-recurse-submodules -d 'Do not update the work trees of submodules'
1264complete -f -c git -n '__fish_git_using_command checkout' -l progress -d 'Report progress even if not connected to a terminal'
1265complete -f -c git -n '__fish_git_using_command checkout' -l no-progress -d "Don't report progress"
1266complete -f -c git -n '__fish_git_using_command checkout' -s f -l force -d 'Switch even if working tree differs or unmerged files exist'
1267complete -f -c git -n '__fish_git_using_command checkout' -s q -l quiet -d 'Suppress feedback messages'
1268complete -f -c git -n '__fish_git_using_command checkout' -l detach -d 'Detach HEAD at named commit'
1269complete -f -c git -n '__fish_git_using_command checkout' -l guess -d 'Guess remote tracking branch (default)'
1270complete -f -c git -n '__fish_git_using_command checkout' -l no-guess -d 'Do not guess remote tracking branch'
1271complete -f -c git -n '__fish_git_using_command checkout' -l overlay -d 'Never remove files from working tree in checkout'
1272complete -f -c git -n '__fish_git_using_command checkout' -l no-overlay -d 'Remove files from working tree not in tree-ish'
1273complete -F -c git -n '__fish_git_using_command checkout' -l pathspec-from-file -d 'Read pathspec from file'
1274complete -f -c git -n '__fish_git_using_command checkout' -l pathspec-file-nul -d 'NUL separator for pathspec-from-file'
1275complete -f -c git -n '__fish_git_using_command checkout' -l ignore-skip-worktree-bits -d 'Check out all files including sparse entries'
1276
1277### sparse-checkout
1278# `init` subcommand is deprecated
1279set -l sparse_co_commands list set add reapply disable check-rules
1280complete -f -c git -n __fish_git_needs_command -a sparse-checkout -d 'Reduce your working tree to a subset of tracked files'
1281complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a set -d 'Enable the necessary sparse-checkout config settings'
1282complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a list -d 'Describe the directories or patterns in the sparse-checkout file'
1283complete -x -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a add -d 'Add directories (in cone mode) or patterns (in non-cone mode)'
1284complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a reapply -d 'Reapply the sparsity pattern rules in case of merge-conflict'
1285complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a disable -d 'Disable sparse-checkout, and restore the working directory to include all files'
1286complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "not __fish_seen_subcommand_from $sparse_co_commands" -a check-rules -d 'Check whether sparsity rules match one or more paths'
1287
1288complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "__fish_seen_subcommand_from add set" -l stdin -d 'read patterns from stdin as a newline-delimited list'
1289complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "__fish_seen_subcommand_from reapply set" -l no-cone -d 'input list is considered a list of patterns instead of directory paths'
1290complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "__fish_seen_subcommand_from reapply set" -l sparse-index -d 'use a sparse index to be more closely aligned with your sparse-checkout definition'
1291complete -f -c git -n "__fish_git_using_command sparse-checkout" -n "__fish_seen_subcommand_from reapply set" -l no-sparse-index -d 'not --sparse-index'
1292
1293### apply
1294complete -c git -n __fish_git_needs_command -a apply -d 'Apply a patch'
1295complete -f -c git -n '__fish_git_using_command apply' -l numstat -d 'Show number of additions and deletions'
1296complete -f -c git -n '__fish_git_using_command apply' -l summary -d 'Output a condensed summary'
1297complete -f -c git -n '__fish_git_using_command apply' -l check -d 'Just check if the patches can be applied'
1298complete -f -c git -n '__fish_git_using_command apply' -l index -d 'Apply patch to index and working tree'
1299complete -f -c git -n '__fish_git_using_command apply' -l cached -d 'Apply patch to index'
1300complete -f -c git -n '__fish_git_using_command apply' -l intent-to-add -d 'Add entry for file in index with no content'
1301complete -f -c git -n '__fish_git_using_command apply' -s 3 -l 3way -d 'Attempt a 3 way merge on conflicts'
1302complete -F -c git -n '__fish_git_using_command apply' -l build-fake-ancestor -d 'Build a temporary index containing these blobs'
1303complete -f -c git -n '__fish_git_using_command apply' -s R -l reverse -d 'Apply the patch in reverse'
1304complete -f -c git -n '__fish_git_using_command apply' -l reject -d 'Leave rejected hunks in *.rej files'
1305complete -f -c git -n '__fish_git_using_command apply' -n '__fish_git_contains_opt numstat' -s z -d 'Do not munge pathnames'
1306complete -x -c git -n '__fish_git_using_command apply am' -s p -d 'Remove n leading path components'
1307complete -x -c git -n '__fish_git_using_command apply am' -s C -d 'Ensure n that lines of surrounding context match'
1308complete -f -c git -n '__fish_git_using_command apply' -l unidiff-zero -d 'Do not break on diffs generated using --unified=0'
1309complete -f -c git -n '__fish_git_using_command apply' -l apply -d 'Always apply patches'
1310complete -f -c git -n '__fish_git_using_command apply' -l no-add -d 'Ignore additions made by patches'
1311complete -f -c git -n '__fish_git_using_command apply' -l allow-binary-replacement -l binary -d 'Also patch binaries'
1312complete -F -c git -n '__fish_git_using_command apply' -l exclude -d 'Dont apply changes to files matching given pattern'
1313complete -F -c git -n '__fish_git_using_command apply' -l include -d 'Apply changes to files matching given pattern'
1314complete -f -c git -n '__fish_git_using_command apply am' -l ignore-space-change -l ignore-whitespace -d 'Ignore whitespace change in context lines'
1315complete -x -c git -n '__fish_git_using_command apply am' -l whitespace -a 'nowarn warn fix error error-all' -d 'Action to take when there are whitespace errors'
1316complete -f -c git -n '__fish_git_using_command apply' -l inaccurate-eof -d 'Work around some diff versions not detecting newlines at end of file'
1317complete -f -c git -n '__fish_git_using_command apply' -s v -l verbose -d 'Report progress to stderr'
1318complete -f -c git -n '__fish_git_using_command apply' -l recount -d 'Do not trust the line counts in the hunk headers'
1319complete -F -c git -n '__fish_git_using_command apply' -l directory -d 'Prepend given path to all filenames'
1320complete -f -c git -n '__fish_git_using_command apply' -l unsafe-paths -d 'Allow patches that work outside working area'
1321
1322### archive
1323complete -f -c git -n __fish_git_needs_command -a archive -d 'Create an archive of files from a tree'
1324complete -f -c git -n '__fish_git_using_command archive' -s l -l list -d "Show all available formats"
1325complete -f -c git -n '__fish_git_using_command archive' -s v -l verbose -d "Be verbose"
1326complete -f -c git -n '__fish_git_using_command archive' -l worktree-attributes -d "Look for attributes in .gitattributes files in the working tree as well"
1327complete -x -c git -n '__fish_git_using_command archive' -l format -a 'tar zip tar.gz tgz' -d 'Format of the resulting archive'
1328complete -F -c git -n '__fish_git_using_command archive' -s o -l output -d 'Write the archive to file instead of stdout'
1329complete -x -c git -n '__fish_git_using_command archive' -l prefix -d 'Prepend prefix to each pathname in the archive'
1330complete -F -c git -n '__fish_git_using_command archive' -l add-file -d 'Add non-tracked file to the archive'
1331complete -x -c git -n '__fish_git_using_command archive' -l remote -d 'Retrieve a tar archive from a remote repository'
1332complete -x -c git -n '__fish_git_using_command archive' -l exec -d 'Path to git-upload-archive on the remote side'
1333
1334### bisect
1335complete -f -c git -n __fish_git_needs_command -a bisect -d 'Use binary search to find what introduced a bug'
1336complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_prev_arg_in bisect' -xa "
1337start\t'Start a new bisect session'
1338bad\t'Mark a commit as bad'
1339new\t'Mark a commit as new'
1340good\t'Mark a commit as good'
1341old\t'Mark a commit as old'
1342terms\t'Show terms used for new/old states'
1343skip\t'Skip some commits'
1344reset\t'Exit a bisect session and reset HEAD'
1345visualize\t'See remaining commits in gitk'
1346replay\t'Replay a bisect log file'
1347log\t'Record a bisect log file'
1348run\t'Bisect automatically with the given command as discriminator'
1349help\t'Print a synopsis of all commands'
1350"
1351complete -c git -n '__fish_git_using_command bisect' -n '__fish_seen_argument --' -F
1352complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l term-new -l term-bad -x -d 'Use another term instead of new/bad'
1353complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l term-old -l term-good -x -d 'Use another term instead of old/good'
1354complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l no-checkout -d 'Do not checkout tree, only update BISECT_HEAD'
1355complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l first-parent -d 'On merge commits, follow only the first parent commit'
1356complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_refs)'
1357complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from bad new good old' -a '(__fish_git_refs)'
1358complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from terms' -l --term-good -d 'Print the term for the old state'
1359complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from terms' -l --term-bad -d 'Print the term for the new state'
1360complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from skip' -a '(__fish_git_ranges)'
1361complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from reset' -a '(__fish_git_refs)'
1362complete -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from replay' -F
1363complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from run' -xa '(__fish_complete_subcommand --fcs-skip=3)'
1364
1365### branch
1366complete -f -c git -n __fish_git_needs_command -a branch -d 'List, create, or delete branches'
1367complete -f -c git -n '__fish_git_using_command branch' -ka '(__fish_git_branches)'
1368complete -f -c git -n '__fish_git_using_command branch' -s d -l delete -d 'Delete branch' -xa '(__fish_git_local_branches)'
1369complete -f -c git -n '__fish_git_using_command branch' -s D -d 'Force deletion of branch' -xa '(__fish_git_local_branches)'
1370complete -f -c git -n '__fish_git_using_command branch' -s f -l force -d 'Reset branch even if it already exists'
1371complete -f -c git -n '__fish_git_using_command branch' -s m -l move -d 'Rename branch'
1372complete -f -c git -n '__fish_git_using_command branch' -s M -d 'Force rename branch'
1373complete -f -c git -n '__fish_git_using_command branch' -s c -l copy -d 'Copy branch'
1374complete -f -c git -n '__fish_git_using_command branch' -s C -d 'Force copy branch'
1375complete -f -c git -n '__fish_git_using_command branch' -s a -l all -d 'Lists both local and remote branches'
1376complete -f -c git -n '__fish_git_using_command branch' -s r -l remotes -d 'List or delete (if used with -d) the remote-tracking branches.'
1377complete -f -c git -n '__fish_git_using_command branch' -s t -l track -l track -d 'Track remote branch'
1378complete -f -c git -n '__fish_git_using_command branch' -l no-track -d 'Do not track remote branch'
1379complete -f -c git -n '__fish_git_using_command branch' -l set-upstream-to -d 'Set remote branch to track' -ka '(__fish_git_branches)'
1380complete -f -c git -n '__fish_git_using_command branch' -l merged -d 'List branches that have been merged'
1381complete -f -c git -n '__fish_git_using_command branch' -l no-merged -d 'List branches that have not been merged'
1382complete -f -c git -n '__fish_git_using_command branch' -l unset-upstream -d 'Remove branch upstream information'
1383complete -f -c git -n '__fish_git_using_command branch' -l edit-description -d 'Edit branch description in editor'
1384complete -f -c git -n '__fish_git_using_command branch' -l contains -d 'List branches that contain the specified commit' -xa '(__fish_git_commits)'
1385complete -f -c git -n '__fish_git_using_command branch' -l no-contains -d 'List branches that don\'t contain the specified commit' -xa '(__fish_git_commits)'
1386
1387### bundle
1388set -l bundlecommands create verify list-heads unbundle
1389complete -f -c git -n __fish_git_needs_command -a bundle -d 'Create, unpack, and manipulate "bundle" files'
1390complete -f -c git -n "__fish_git_using_command bundle" -n "not __fish_seen_subcommand_from $bundlecommands" -a "create\t'Create a bundle'
1391verify\t'Check that the bundle is valid and will apply cleanly'
1392list-heads\t'List the references defined in the bundle'
1393unbundle\t'Build a pack index file and print all defined references'"
1394complete -f -c git -n "__fish_git_using_command bundle" -n "__fish_seen_subcommand_from create verify" -s q -l quiet -d 'Do not show progress meter'
1395complete -f -c git -n "__fish_git_using_command bundle" -n "__fish_seen_subcommand_from create unbundle" -l progress -d 'Show progress meter'
1396complete -f -c git -n "__fish_git_using_command bundle" -n "__fish_seen_subcommand_from create" -l all-progress -d 'Show progress meter during object writing phase'
1397complete -f -c git -n "__fish_git_using_command bundle" -n "__fish_seen_subcommand_from create" -l all-progress-implied -d 'Similar to --all-progress when progress meter is shown'
1398complete -x -c git -n "__fish_git_using_command bundle" -n "__fish_seen_subcommand_from create" -l version -d 'Specify bundle format version'
1399# FIXME: <file> should be suggested first and <git-rev-list args> second (also, '--all' is only valid in rev-list)
1400complete -c git -n '__fish_git_using_command bundle' -n "__fish_seen_subcommand_from create" -ka '--all\t"All refs"'
1401complete -c git -n '__fish_git_using_command bundle' -n "__fish_seen_subcommand_from create" -ka '(__fish_git_ranges)'
1402
1403### cherry
1404complete -f -c git -n __fish_git_needs_command -a cherry -d 'Find commits yet to be applied to upstream'
1405complete -f -c git -n '__fish_git_using_command cherry' -s v -d 'Show the commit subjects next to the SHA1s'
1406complete -f -c git -n '__fish_git_using_command cherry' -ka '(__fish_git_refs)' -d Upstream
1407
1408### cherry-pick
1409complete -f -c git -n __fish_git_needs_command -a cherry-pick -d 'Reapply a commit on another branch'
1410complete -f -c git -n '__fish_git_using_command cherry-pick' -ka '(__fish_git_ranges)'
1411# TODO: Filter further
1412complete -f -c git -n '__fish_git_using_command cherry-pick' -n __fish_git_possible_commithash -ka '(__fish_git_commits)'
1413complete -f -c git -n '__fish_git_using_command cherry-pick' -s e -l edit -d 'Edit the commit message prior to committing'
1414complete -f -c git -n '__fish_git_using_command cherry-pick' -s x -d 'Append info in generated commit on the origin of the cherry-picked change'
1415complete -f -c git -n '__fish_git_using_command cherry-pick' -s n -l no-commit -d 'Apply changes without making any commit'
1416complete -f -c git -n '__fish_git_using_command cherry-pick' -s s -l signoff -d 'Add Signed-off-by line to the commit message'
1417complete -f -c git -n '__fish_git_using_command cherry-pick' -l ff -d 'Fast-forward if possible'
1418complete -f -c git -n '__fish_git_using_command cherry-pick' -l continue -d 'Continue the operation in progress'
1419complete -f -c git -n '__fish_git_using_command cherry-pick' -l abort -d 'Cancel the operation'
1420complete -f -c git -n '__fish_git_using_command cherry-pick' -l skip -d 'Skip the current commit and continue with the rest of the sequence'
1421
1422### clone
1423complete -f -c git -n __fish_git_needs_command -a clone -d 'Clone a repository into a new directory'
1424complete -f -c git -n '__fish_git_using_command clone' -l no-hardlinks -d 'Copy files instead of using hardlinks'
1425complete -f -c git -n '__fish_git_using_command clone' -s q -l quiet -d 'Operate quietly and do not report progress'
1426complete -f -c git -n '__fish_git_using_command clone' -s v -l verbose -d 'Provide more information on what is going on'
1427complete -f -c git -n '__fish_git_using_command clone' -s n -l no-checkout -d 'No checkout of HEAD is performed after the clone is complete'
1428complete -f -c git -n '__fish_git_using_command clone' -l bare -d 'Make a bare Git repository'
1429complete -f -c git -n '__fish_git_using_command clone' -l mirror -d 'Set up a mirror of the source repository'
1430complete -f -c git -n '__fish_git_using_command clone' -s o -l origin -d 'Use a specific name of the remote instead of the default'
1431complete -f -c git -n '__fish_git_using_command clone' -s b -l branch -d 'Use a specific branch instead of the one used by the cloned repository'
1432complete -f -c git -n '__fish_git_using_command clone' -l depth -d 'Truncate the history to a specified number of revisions'
1433complete -f -c git -n '__fish_git_using_command clone' -l recursive -d 'Initialize all submodules within the cloned repository'
1434complete -f -c git -n '__fish_git_using_command clone' -l filter -ra '(__fish_git_filters)' -d 'Partial clone by requesting a subset of objects from server'
1435complete -f -c git -n '__fish_git_using_command clone' -l single-branch -d 'Clone only the history leading to the tip of a single branch'
1436complete -f -c git -n '__fish_git_using_command clone' -l no-single-branch -d 'Clone histories near the tips of all branches'
1437complete -f -c git -n '__fish_git_using_command clone' -s l -l local -d 'Bypass transport mechanism for local repositories'
1438complete -f -c git -n '__fish_git_using_command clone' -l no-local -d 'Use Git transport for local paths'
1439complete -f -c git -n '__fish_git_using_command clone' -s s -l shared -d 'Setup .git/objects/info/alternates to share objects'
1440complete -f -c git -n '__fish_git_using_command clone' -l dissociate -d 'Stop borrowing objects from reference repositories after clone'
1441complete -f -c git -n '__fish_git_using_command clone' -l progress -d 'Force progress status'
1442complete -f -c git -n '__fish_git_using_command clone' -l server-option -d 'Transmit string to the server when using protocol version 2'
1443complete -f -c git -n '__fish_git_using_command clone' -l no-reject-shallow -d 'Do not fail if the source repository is a shallow repository'
1444complete -f -c git -n '__fish_git_using_command clone' -l reject-shallow -d 'Fail if the source repository is a shallow repository'
1445complete -f -c git -n '__fish_git_using_command clone' -l sparse -d 'Employ a sparse-checkout'
1446complete -f -c git -n '__fish_git_using_command clone' -l also-filter-submodules -d 'Apply partial clone filter to submodules'
1447complete -f -c git -n '__fish_git_using_command clone' -l revision -r -d 'Fetch history leading to the given revision'
1448complete -f -c git -n '__fish_git_using_command clone' -s u -l upload-pack -r -d 'Specify a non-default path for the command on the other end'
1449complete -f -c git -n '__fish_git_using_command clone' -l template -r -d 'Specify the directory from which templates will be used'
1450complete -f -c git -n '__fish_git_using_command clone' -s c -l config -r -d 'Set a configuration variable in the new repository'
1451complete -f -c git -n '__fish_git_using_command clone' -l shallow-since -r -d 'Create a shallow clone with a history after the specified time'
1452complete -f -c git -n '__fish_git_using_command clone' -l shallow-exclude -r -d 'Create a shallow clone excluding commits from a specified ref'
1453complete -f -c git -n '__fish_git_using_command clone' -l no-tags -d 'Do not clone tags'
1454complete -f -c git -n '__fish_git_using_command clone' -l tags -d 'Clone tags'
1455complete -f -c git -n '__fish_git_using_command clone' -l recurse-submodules -r -d 'Initialize and clone submodules'
1456complete -f -c git -n '__fish_git_using_command clone' -l shallow-submodules -d 'Clone submodules with a depth of 1'
1457complete -f -c git -n '__fish_git_using_command clone' -l no-shallow-submodules -d 'Do not clone submodules shallowly'
1458complete -f -c git -n '__fish_git_using_command clone' -l remote-submodules -d 'Use submodule remote-tracking branch to update'
1459complete -f -c git -n '__fish_git_using_command clone' -l no-remote-submodules -d 'Do not use submodule remote-tracking branch to update'
1460complete -f -c git -n '__fish_git_using_command clone' -l separate-git-dir -r -d 'Place the cloned repository in a specified directory'
1461complete -f -c git -n '__fish_git_using_command clone' -l ref-format -f -a "files reftable" -d 'Specify the ref storage format'
1462complete -f -c git -n '__fish_git_using_command clone' -s j -l jobs -r -d 'Number of submodules fetched at the same time'
1463complete -f -c git -n '__fish_git_using_command clone' -l bundle-uri -r -d 'Fetch a bundle from the given URI'
1464
1465### commit
1466complete -c git -n __fish_git_needs_command -a commit -d 'Record changes to the repository'
1467complete -c git -n '__fish_git_using_command commit' -l amend -d 'Amend the log message of the last commit'
1468complete -f -c git -n '__fish_git_using_command commit && not string match -rq -- "^(--fixup\b|--squash\b|-C|-c)" (commandline -xpc)[-1]' -a '(__fish_git_files modified deleted modified-staged-deleted untracked)'
1469complete -c git -n '__fish_git_using_command commit' -s a -l all -d 'Automatically stage modified and deleted files'
1470complete -c git -n '__fish_git_using_command commit' -s p -l patch -d 'Use interactive patch selection interface'
1471complete -f -c git -n '__fish_git_using_command commit' -l fixup -d 'Fixup commit to be used with rebase --autosquash'
1472complete -f -c git -n '__fish_git_using_command commit' -l squash -d 'Squash commit to be used with rebase --autosquash'
1473complete -c git -n '__fish_git_using_command commit' -l reset-author -d 'When amending, reset author of commit to the committer'
1474complete -x -c git -n '__fish_git_using_command commit' -l author -d 'Override the commit author'
1475complete -x -c git -n '__fish_git_using_command commit' -l cleanup -a "
1476    strip\t'Leading/trailing whitespace/empty lines, #commentary'
1477    whitespace\t'Like strip but keep #commentary'
1478    verbatim\t'Do not change the message'
1479    scissors\t'Like whitespace but also remove after scissor lines'
1480    default\t'Like strip if the message is to be edited, whitespace otherwise'
1481" -d 'How to clean up the commit message'
1482complete -x -c git -n '__fish_git_using_command commit' -l date -d 'Override the author date'
1483complete -x -c git -n '__fish_git_using_command commit' -s m -l message -d 'Use the given message as the commit message'
1484complete -f -c git -n '__fish_git_using_command commit' -l no-edit -d 'Use the selected commit message without launching an editor'
1485complete -f -c git -n '__fish_git_using_command commit' -l no-gpg-sign -d 'Do not sign commit'
1486complete -f -c git -n '__fish_git_using_command commit' -s n -l no-verify -d 'Do not run pre-commit and commit-msg hooks'
1487complete -f -c git -n '__fish_git_using_command commit' -n 'string match -rq -- "^(--fixup\b|--squash\b|-C|-c|--reuse-message\b|--reedit-message\b)" (commandline -xpc)[-1]' -ka '(__fish_git_recent_commits)'
1488complete -f -c git -n '__fish_git_using_command commit' -l allow-empty -d 'Create a commit with no changes'
1489complete -f -c git -n '__fish_git_using_command commit' -l allow-empty-message -d 'Create a commit with no commit message'
1490complete -f -c git -n '__fish_git_using_command commit' -s s -l signoff -d 'Append Signed-off-by trailer to commit message'
1491complete -f -c git -n '__fish_git_using_command commit' -l no-signoff -d 'Do not append Signed-off-by trailer to commit message'
1492complete -f -c git -n '__fish_git_using_command commit' -s C -l reuse-message -d 'Reuse log message and authorship of an existing commit'
1493complete -f -c git -n '__fish_git_using_command commit' -s c -l reedit-message -d 'Like --reuse-message, but allow editing commit message'
1494complete -f -c git -n '__fish_git_using_command commit' -s e -l edit -d 'Further edit the message taken from -m, -C, or -F'
1495complete -f -c git -n '__fish_git_using_command commit' -l no-edit -d 'Do not edit the commit message'
1496complete -f -c git -n '__fish_git_using_command commit' -s q -l quiet -d 'Suppress commit summary message'
1497complete -f -c git -n '__fish_git_using_command commit' -l dry-run -d 'Show what would be committed without committing'
1498complete -f -c git -n '__fish_git_using_command commit' -l short -d 'Show short format output for dry-run'
1499complete -f -c git -n '__fish_git_using_command commit' -l porcelain -d 'Show porcelain format output for dry-run'
1500complete -f -c git -n '__fish_git_using_command commit' -l long -d 'Show long format output for dry-run (default)'
1501complete -f -c git -n '__fish_git_using_command commit' -s z -l null -d 'Terminate entries with NUL in dry-run'
1502complete -f -c git -n '__fish_git_using_command commit' -l status -d 'Include git status output in commit message template'
1503complete -f -c git -n '__fish_git_using_command commit' -l no-status -d 'Do not include git status output in commit message template'
1504complete -f -c git -n '__fish_git_using_command commit' -s i -l include -d 'Stage contents of given paths before committing'
1505complete -f -c git -n '__fish_git_using_command commit' -s o -l only -d 'Commit only from paths specified on command line'
1506complete -f -c git -n '__fish_git_using_command commit' -l trailer -d 'Add trailer to commit message'
1507complete -F -c git -n '__fish_git_using_command commit' -s t -l template -d 'Use file as commit message template'
1508complete -F -c git -n '__fish_git_using_command commit' -l pathspec-from-file -d 'Read pathspec from file'
1509complete -f -c git -n '__fish_git_using_command commit' -l pathspec-file-nul -d 'NUL separator for pathspec-from-file'
1510
1511### count-objects
1512complete -f -c git -n __fish_git_needs_command -a count-objects -d 'Count number of objects and disk consumption'
1513complete -f -c git -n '__fish_git_using_command count-objects' -s v -l verbose -d 'Be verbose'
1514complete -f -c git -n '__fish_git_using_command count-objects' -s H -l human-readable -d 'Print in human readable format'
1515
1516### daemon
1517complete -c git -n __fish_git_needs_command -a daemon -d 'A simple server for git repositories'
1518complete -f -c git -n '__fish_git_using_command daemon' -l strict-paths -d 'Match paths exactly'
1519complete -F -c git -n '__fish_git_using_command daemon' -l base-path -d 'Git Root'
1520complete -f -c git -n '__fish_git_using_command daemon' -l base-path-relaxed -d 'When looking up with base path fails, try without it'
1521complete -F -c git -n '__fish_git_using_command daemon' -l interpolated-path -d 'Construct a path from the given template'
1522complete -f -c git -n '__fish_git_using_command daemon' -l export-all -d 'Allow pulling from all directories'
1523complete -f -c git -n '__fish_git_using_command daemon' -l inetd -d 'Run as inetd service'
1524complete -x -c git -n '__fish_git_using_command daemon' -l listen -d 'Listen on this IP'
1525complete -x -c git -n '__fish_git_using_command daemon' -l port -d 'Listen on this port'
1526complete -x -c git -n '__fish_git_using_command daemon' -l init-timeout -d 'Connection timeout'
1527complete -x -c git -n '__fish_git_using_command daemon' -l timeout -d 'Timeout for each request'
1528complete -x -c git -n '__fish_git_using_command daemon' -l max-connections -d 'Maximum parallel clients'
1529complete -f -c git -n '__fish_git_using_command daemon' -l syslog -d '--log-destination=syslog'
1530complete -x -c git -n '__fish_git_using_command daemon' -l log-destination -a 'stderr syslog none' -d 'Log destination'
1531complete -x -c git -n '__fish_git_using_command daemon' -l user-path -d 'Allow ~user notation to be used'
1532complete -f -c git -n '__fish_git_using_command daemon' -l verbose -d 'Log all details'
1533complete -f -c git -n '__fish_git_using_command daemon' -l reuseaddr -d 'Reuse address when binding to listening server'
1534complete -f -c git -n '__fish_git_using_command daemon' -l detach -d 'Detach from shell'
1535complete -x -c git -n '__fish_git_using_command daemon' -l reuseaddr -d 'Save the process ID in file'
1536complete -x -c git -n '__fish_git_using_command daemon' -l user -d 'Change daemon\'s uid'
1537complete -x -c git -n '__fish_git_using_command daemon' -l group -d 'Change daemon\'s gid'
1538complete -x -c git -n '__fish_git_using_command daemon' -l enable -a 'upload-pack upload-archive receive-pack' -d 'Enable service'
1539complete -x -c git -n '__fish_git_using_command daemon' -l disable -a 'upload-pack upload-archive receive-pack' -d 'Disable service'
1540complete -x -c git -n '__fish_git_using_command daemon' -l allow-override -a 'upload-pack upload-archive receive-pack' -d 'Allow overriding site-wide default per repository configuration'
1541complete -x -c git -n '__fish_git_using_command daemon' -l forbid-override -a 'upload-pack upload-archive receive-pack' -d 'Forbid overriding site-wide default per repository configuration'
1542complete -f -c git -n '__fish_git_using_command daemon' -l informative-errors -d 'Report more verbose errors to clients'
1543complete -f -c git -n '__fish_git_using_command daemon' -l no-informative-errors -d 'Report less verbose errors to clients'
1544complete -x -c git -n '__fish_git_using_command daemon' -l access-hook -d 'Hook to run whenever a client connects'
1545
1546### describe
1547complete -c git -n __fish_git_needs_command -a describe -d 'Give an object a human readable name'
1548__fish_git_add_revision_completion -n '__fish_git_using_command describe'
1549complete -f -c git -n '__fish_git_using_command describe' -l dirty -d 'Describe the state of the working tree, append dirty if there are local changes'
1550complete -f -c git -n '__fish_git_using_command describe' -l broken -d 'Describe the state of the working tree, append -broken instead of erroring'
1551complete -f -c git -n '__fish_git_using_command describe' -l all -d 'Use all tags, not just annotated'
1552complete -f -c git -n '__fish_git_using_command describe' -l tags -d 'Use all commits/tags, not just annotated tags'
1553complete -f -c git -n '__fish_git_using_command describe' -l contains -d 'Find the tag that comes after the commit'
1554complete -f -c git -n '__fish_git_using_command describe' -l abbrev -d 'Use <n> digits, or as many digits as needed to form a unique object name'
1555complete -f -c git -n '__fish_git_using_command describe' -l candidates -d 'Consider up to <n> candidates'
1556complete -f -c git -n '__fish_git_using_command describe' -l exact-match -d 'Only output exact matches'
1557complete -f -c git -n '__fish_git_using_command describe' -l debug -d 'Display debug info'
1558complete -f -c git -n '__fish_git_using_command describe' -l long -d 'Always output the long format'
1559complete -f -c git -n '__fish_git_using_command describe' -l match -d 'Only consider tags matching the given glob pattern'
1560complete -f -c git -n '__fish_git_using_command describe' -l exclude -d 'Do not consider tags matching the given glob pattern'
1561complete -f -c git -n '__fish_git_using_command describe' -l always -d 'Show uniquely abbreviated commit object as fallback'
1562complete -f -c git -n '__fish_git_using_command describe' -l first-parent -d 'Follow only the first parent of a merge commit'
1563
1564### diff
1565complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits and working tree'
1566complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -n 'not __fish_git_contains_opt no-index' -ka '(__fish_git_ranges)'
1567complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -n 'not __fish_git_contains_opt no-index' -ka '(__fish_git_complete_stashes)'
1568begin
1569    set -lx __fish_git_recent_commits_arg --all
1570    __fish_git_add_revision_completion -n '__fish_git_using_command diff' -n 'not __fish_git_contains_opt no-index'
1571end
1572complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
1573complete -c git -n '__fish_git_using_command diff' -l staged -d 'Show diff of changes in the index'
1574complete -c git -n '__fish_git_using_command diff' -l no-index -d 'Compare two paths on the filesystem'
1575complete -c git -n '__fish_git_using_command diff' -l exit-code -d 'Exit with 1 if there were differences or 0 if no differences'
1576complete -c git -n '__fish_git_using_command diff' -l quiet -d 'Disable all output of the program, implies --exit-code'
1577complete -c git -n '__fish_git_using_command diff' -s 1 -l base -d 'Compare the working tree with the "base" version'
1578complete -c git -n '__fish_git_using_command diff' -s 2 -l ours -d 'Compare the working tree with the "our branch"'
1579complete -c git -n '__fish_git_using_command diff' -s 3 -l theirs -d 'Compare the working tree with the "their branch"'
1580complete -c git -n '__fish_git_using_command diff' -s 0 -d 'Omit diff output for unmerged entries and just show "Unmerged"'
1581complete -c git -n '__fish_git_using_command diff' -k -n 'not __fish_git_contains_opt cached staged' -a '(
1582    set -l kinds modified
1583    contains -- -- (commandline -xpc) && set -a kinds deleted modified-staged-deleted
1584    __fish_git_files $kinds
1585)'
1586complete -c git -n '__fish_git_using_command diff' -n '__fish_git_contains_opt cached staged' -fa '(__fish_git_files all-staged)'
1587
1588### Function to list available tools for git difftool and mergetool
1589
1590function __fish_git_diffmerge_tools -a cmd
1591    git $cmd --tool-help | while read -l line
1592        string match -q 'The following tools are valid, but not currently available:' -- $line
1593        and break
1594        string replace -f -r '^\t\t(\w+).*$' '$1' -- $line
1595    end
1596end
1597
1598### difftool
1599complete -c git -n __fish_git_needs_command -a difftool -d 'Open diffs in a visual tool'
1600complete -c git -n '__fish_git_using_command difftool' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
1601complete -c git -n '__fish_git_using_command difftool' -l cached -d 'Visually show diff of changes in the index'
1602complete -f -c git -n '__fish_git_using_command difftool' -a '(
1603    set -l kinds modified
1604    contains -- -- (commandline -xpc) && set -a kinds deleted modified-staged-deleted
1605    __fish_git_files $kinds
1606)'
1607complete -f -c git -n '__fish_git_using_command difftool' -s g -l gui -d 'Use `diff.guitool` instead of `diff.tool`'
1608complete -f -c git -n '__fish_git_using_command difftool' -s d -l dir-diff -d 'Perform a full-directory diff'
1609complete -c git -n '__fish_git_using_command difftool' -l prompt -d 'Prompt before each invocation of the diff tool'
1610complete -f -c git -n '__fish_git_using_command difftool' -s y -l no-prompt -d 'Do not prompt before launching a diff tool'
1611complete -f -c git -n '__fish_git_using_command difftool' -l symlinks -d 'Use symlinks in dir-diff mode'
1612complete -f -c git -n '__fish_git_using_command difftool' -s t -l tool -d 'Use the specified diff tool' -a "(__fish_git_diffmerge_tools difftool)"
1613complete -f -c git -n '__fish_git_using_command difftool' -l tool-help -d 'Print a list of diff tools that may be used with `--tool`'
1614complete -f -c git -n '__fish_git_using_command difftool' -l trust-exit-code -d 'Exit when an invoked diff tool returns a non-zero exit code'
1615complete -f -c git -n '__fish_git_using_command difftool' -s x -l extcmd -d 'Specify a custom command for viewing diffs'
1616complete -f -c git -n '__fish_git_using_command difftool' -l no-gui -d 'Overrides --gui setting'
1617complete -f -c git -n '__fish_git_using_command difftool' -l tool-help -d 'Print a list of diff tools that may be used'
1618complete -f -c git -n '__fish_git_using_command difftool' -s d -l dir-diff -d 'Copy modified files to a temporary location and perform dir diff'
1619complete -f -c git -n '__fish_git_using_command difftool' -l symlinks -d 'Use symlinks in dir-diff mode'
1620complete -f -c git -n '__fish_git_using_command difftool' -l no-symlinks -d 'Do not use symlinks in dir-diff mode'
1621complete -f -c git -n '__fish_git_using_command difftool' -l no-trust-exit-code -d 'Do not exit when diff tool returns non-zero'
1622complete -f -c git -n '__fish_git_using_command difftool' -s y -l no-prompt -d 'Do not prompt before launching diff tool'
1623complete -f -c git -n '__fish_git_using_command difftool' -l prompt -d 'Prompt before each invocation of diff tool'
1624
1625### gc
1626complete -f -c git -n __fish_git_needs_command -a gc -d 'Collect garbage (unreachable commits etc)'
1627complete -f -c git -n '__fish_git_using_command gc' -l aggressive -d 'Aggressively optimize the repository'
1628complete -f -c git -n '__fish_git_using_command gc' -l auto -d 'Checks any housekeeping is required and then run'
1629complete -f -c git -n '__fish_git_using_command gc' -l prune -d 'Prune loose objects older than date'
1630complete -f -c git -n '__fish_git_using_command gc' -l no-prune -d 'Do not prune any loose objects'
1631complete -f -c git -n '__fish_git_using_command gc' -l quiet -d 'Be quiet'
1632complete -f -c git -n '__fish_git_using_command gc' -l force -d 'Force `git gc` to run'
1633complete -f -c git -n '__fish_git_using_command gc' -l keep-largest-pack -d 'Ignore `gc.bigPackThreshold`'
1634
1635### grep
1636complete -c git -n __fish_git_needs_command -a grep -d 'Print lines matching a pattern'
1637complete -f -c git -n '__fish_git_using_command grep' -l cached -d 'Search blobs registered in the index file'
1638complete -f -c git -n '__fish_git_using_command grep' -l no-index -d 'Search files in the current directory not managed by Git'
1639complete -f -c git -n '__fish_git_using_command grep' -l untracked -d 'Search also in untracked files'
1640complete -f -c git -n '__fish_git_using_command grep' -l no-exclude-standard -d 'Also search in ignored files by not honoring the .gitignore mechanism'
1641complete -f -c git -n '__fish_git_using_command grep' -l exclude-standard -d 'Do not search ignored files specified via the .gitignore mechanism'
1642complete -f -c git -n '__fish_git_using_command grep' -l recurse-submodules -d 'Recursively search in each submodule that is active and checked out in the repository'
1643complete -f -c git -n '__fish_git_using_command grep' -s a -l text -d 'Process binary files as if they were text'
1644complete -f -c git -n '__fish_git_using_command grep' -l textconv -d 'Honor textconv filter settings'
1645complete -f -c git -n '__fish_git_using_command grep' -l no-textconv -d 'Do not honor textconv filter settings'
1646complete -f -c git -n '__fish_git_using_command grep' -s i -l ignore-case -d 'Ignore case differences between the patterns and the files'
1647complete -f -c git -n '__fish_git_using_command grep' -s I -d 'Don\'t match the pattern in binary files'
1648complete -f -c git -n '__fish_git_using_command grep' -s r -l recursive -d 'Descend into levels of directories endlessly'
1649complete -f -c git -n '__fish_git_using_command grep' -l no-recursive -d 'Do not descend into directories'
1650complete -f -c git -n '__fish_git_using_command grep' -s w -l word-regexp -d 'Match the pattern only at word boundary'
1651complete -f -c git -n '__fish_git_using_command grep' -s v -l invert-match -d 'Select non-matching lines'
1652complete -f -c git -n '__fish_git_using_command grep' -l full-name -d 'Forces paths to be output relative to the project top directory'
1653complete -f -c git -n '__fish_git_using_command grep' -s E -l extended-regexp -d 'Use POSIX extended regexp for patterns'
1654complete -f -c git -n '__fish_git_using_command grep' -s G -l basic-regexp -d 'Use POSIX basic regexp for patterns'
1655complete -f -c git -n '__fish_git_using_command grep' -s P -l perl-regexp -d 'Use Perl-compatible regular expressions for patterns'
1656complete -f -c git -n '__fish_git_using_command grep' -s F -l fixed-strings -d 'Don\'t interpret pattern as a regex'
1657complete -f -c git -n '__fish_git_using_command grep' -s n -l line-number -d 'Prefix the line number to matching lines'
1658complete -f -c git -n '__fish_git_using_command grep' -l column -d 'Prefix the 1-indexed byte-offset of the first match from the start of the matching line'
1659complete -f -c git -n '__fish_git_using_command grep' -s l -l files-with-matches -d 'Show only the names of files that contain matches'
1660complete -f -c git -n '__fish_git_using_command grep' -s L -l files-without-match -d 'Show only the names of files that do not contain matches'
1661complete -f -c git -n '__fish_git_using_command grep' -s z -l null -d 'Use \\0 as the delimiter for pathnames in the output, and print them verbatim'
1662complete -f -c git -n '__fish_git_using_command grep' -s o -l only-matching -d 'Print only the matched parts of a matching line'
1663complete -f -c git -n '__fish_git_using_command grep' -s c -l count -d 'Instead of showing every matched line, show the number of lines that match'
1664complete -f -c git -n '__fish_git_using_command grep' -l no-color -d 'Turn off match highlighting'
1665complete -f -c git -n '__fish_git_using_command grep' -l break -d 'Print an empty line between matches from different files'
1666complete -f -c git -n '__fish_git_using_command grep' -l heading -d 'Show the filename once above the matches in that file'
1667complete -f -c git -n '__fish_git_using_command grep' -s p -l show-function -d 'Show the function name for the match'
1668complete -f -c git -n '__fish_git_using_command grep' -s W -l function-context -d 'Show the surrounding function'
1669complete -f -c git -n '__fish_git_using_command grep' -s e -d 'The next parameter is the pattern'
1670complete -f -c git -n '__fish_git_using_command grep' -l and -d 'Combine patterns using and'
1671complete -f -c git -n '__fish_git_using_command grep' -l or -d 'Combine patterns using or'
1672complete -f -c git -n '__fish_git_using_command grep' -l not -d 'Combine patterns using not'
1673complete -f -c git -n '__fish_git_using_command grep' -l all-match -d 'Only match files that can match all the pattern expressions when giving multiple'
1674complete -f -c git -n '__fish_git_using_command grep' -s q -l quiet -d 'Just exit with status 0 when there is a match and with non-zero status when there isn\'t'
1675complete -c git -n '__fish_git_using_command grep' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_refs)'
1676complete -x -c git -n '__fish_git_using_command grep' -l max-depth -d 'Maximum depth of directory traversal'
1677complete -f -c git -n '__fish_git_using_command grep' -s h -d 'Do not output the filename for each match'
1678complete -f -c git -n '__fish_git_using_command grep' -s H -d 'Show filename for each match (default)'
1679complete -x -c git -n '__fish_git_using_command grep' -s O -l open-files-in-pager -d 'Open matching files in pager'
1680complete -x -c git -n '__fish_git_using_command grep' -s C -l context -d 'Show context lines before and after matches'
1681complete -x -c git -n '__fish_git_using_command grep' -s A -l after-context -d 'Show context lines after matches'
1682complete -x -c git -n '__fish_git_using_command grep' -s B -l before-context -d 'Show context lines before matches'
1683complete -x -c git -n '__fish_git_using_command grep' -l threads -d 'Number of grep worker threads to use'
1684complete -f -c git -n '__fish_git_using_command grep' -l break -d 'Print empty line between matches from different files'
1685complete -f -c git -n '__fish_git_using_command grep' -l heading -d 'Show filename above matches in that file'
1686complete -f -c git -n '__fish_git_using_command grep' -l untracked -d 'Search in untracked files'
1687complete -f -c git -n '__fish_git_using_command grep' -l no-index -d 'Search files in current directory that is not managed by Git'
1688complete -f -c git -n '__fish_git_using_command grep' -l recurse-submodules -d 'Recursively search in each submodule'
1689
1690### history
1691set -l git_history_commands fixup reword split
1692complete -f -c git -n __fish_git_needs_command -a history -d 'Rewrite history'
1693complete -f -c git -n "__fish_git_using_command history" -n "not __fish_seen_subcommand_from $git_history_commands" -a fixup -d 'Fixup a commit'
1694complete -f -c git -n "__fish_git_using_command history" -n "not __fish_seen_subcommand_from $git_history_commands" -a reword -d 'Rewrite a commit message'
1695complete -f -c git -n "__fish_git_using_command history" -n "not __fish_seen_subcommand_from $git_history_commands" -a split -d 'Split up a commit'
1696
1697complete -f -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from fixup reword split' -l dry-run -d 'Do not update references'
1698complete -x -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from fixup reword split' -l update-refs -a 'branches head'
1699complete -x -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from fixup reword' -ka '(__fish_git_recent_commits)'
1700complete -f -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from fixup' -l reedit-message -d 'Open editor to modify commit message'
1701complete -x -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from fixup' -l empty -a 'drop keep abort'
1702complete -x -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from split' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_recent_commits)'
1703complete -F -c git -n '__fish_git_using_command history' -n '__fish_seen_subcommand_from split' -n 'contains -- -- (commandline -xpc)'
1704
1705### init
1706complete -f -c git -n __fish_git_needs_command -a init -d 'Create an empty git repository'
1707complete -f -c git -n '__fish_git_using_command init' -s q -l quiet -d 'Only print error and warning messages'
1708complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare repository'
1709complete -F -c git -n '__fish_git_using_command init' -l template -d 'Directory from which templates will be used'
1710complete -F -c git -n '__fish_git_using_command init' -l separate-git-dir -d 'Create git dir at specified path'
1711complete -x -c git -n '__fish_git_using_command init' -l object-format -a 'sha1 sha256' -d 'Specify hash algorithm for objects'
1712complete -x -c git -n '__fish_git_using_command init' -s b -l initial-branch -d 'Use specified name for initial branch'
1713complete -x -c git -n '__fish_git_using_command init' -l shared -a 'false true umask group all world everybody' -d 'Specify that the repository is shared'
1714
1715### interpret-trailers
1716complete -c git -n __fish_git_needs_command -a interpret-trailers -d 'Add or parse structured information in commit messages'
1717complete -f -c git -n '__fish_git_using_command interpret-trailers' -l in-place -d 'Edit the files in place'
1718complete -f -c git -n '__fish_git_using_command interpret-trailers' -l trim-empty -d 'Remove trailers with whitespace values'
1719complete -f -c git -n '__fish_git_using_command interpret-trailers' -l trailer -r -d 'Key-value pair to apply as a trailer'
1720complete -f -c git -n '__fish_git_using_command interpret-trailers' -l where -ra 'after before end start' -d 'Where new trailers will be added'
1721complete -f -c git -n '__fish_git_using_command interpret-trailers' -l no-where -d 'Clear the effect of previous use of --where'
1722complete -f -c git -n '__fish_git_using_command interpret-trailers' -l if-exists -ra 'addIfDifferent addIfDifferentNeighbor add replace doNothing' -d 'What to do when there is already a trailer with the same key'
1723complete -f -c git -n '__fish_git_using_command interpret-trailers' -l no-if-exists -d 'Clear the effect of previous use of --if-exists'
1724complete -f -c git -n '__fish_git_using_command interpret-trailers' -l if-missing -ra 'doNothing add' -d 'What to do when there is no other trailer with the same key'
1725complete -f -c git -n '__fish_git_using_command interpret-trailers' -l no-if-missing -d 'Clear the effect of previous use of --if-missing'
1726complete -f -c git -n '__fish_git_using_command interpret-trailers' -l only-trailers -d 'Output only trailers'
1727complete -f -c git -n '__fish_git_using_command interpret-trailers' -l only-input -d 'Output only trailers from the input'
1728complete -f -c git -n '__fish_git_using_command interpret-trailers' -l unfold -d 'Unfold multiline trailer values'
1729complete -f -c git -n '__fish_git_using_command interpret-trailers' -l parse -d 'Alias for --only-trailers --only-input --unfold'
1730complete -f -c git -n '__fish_git_using_command interpret-trailers' -l no-divider -d 'Do not treat --- as the end of the commit message'
1731
1732### shortlog
1733complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog'
1734complete -c git -n '__fish_git_using_command shortlog' -a '(__fish_git ls-files)'
1735complete -c git -n '__fish_git_using_command shortlog' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
1736complete -c git -n '__fish_git_using_command shortlog' -s n -l numbered -d 'Sort output by number of commits per group'
1737complete -c git -n '__fish_git_using_command shortlog' -l no-numbered -d 'Sort output alphabetically by author'
1738complete -c git -n '__fish_git_using_command shortlog' -s s -l summary -d 'Only show commit counts per group'
1739complete -c git -n '__fish_git_using_command shortlog' -l no-summary -d 'Show commit subjects for each entry'
1740complete -c git -n '__fish_git_using_command shortlog' -s e -l email -d 'Display email address alongside each name'
1741complete -c git -n '__fish_git_using_command shortlog' -l no-email -d 'Hide email addresses in the output'
1742complete -c git -n '__fish_git_using_command shortlog' -s c -l committer -d 'Group commits by committer instead of author'
1743complete -c git -n '__fish_git_using_command shortlog' -l no-committer -d 'Group commits by author (default)'
1744complete -x -c git -n '__fish_git_using_command shortlog' -l group -a 'author\tGroup\ by\ author committer\tGroup\ by\ committer trailer:\tGroup\ by\ trailer format:\tGroup\ by\ pretty\ format' -d 'Group commits by author, committer, trailer, or format'
1745complete -c git -n '__fish_git_using_command shortlog' -l no-group -d 'Disable custom groupings'
1746complete -c git -n '__fish_git_using_command shortlog' -s w -d 'Linewrap entries as width[,indent1[,indent2]]'
1747
1748### log
1749complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs'
1750complete -c git -n '__fish_git_using_command log' -a '(__fish_git ls-files)'
1751complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
1752complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames'
1753complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t print ref names'
1754complete -f -c git -n '__fish_git_using_command log' -l decorate -a 'short\tHide\ prefixes full\tShow\ full\ ref\ names auto\tHide\ prefixes\ if\ printed\ to\ terminal no\tDon\\\'t\ display\ ref' -d 'Print out ref names'
1755complete -c git -n '__fish_git_using_command log' -l source -d 'Print ref name by which each commit was reached'
1756complete -c git -n '__fish_git_using_command log' -l use-mailmap
1757complete -c git -n '__fish_git_using_command log' -l full-diff
1758complete -c git -n '__fish_git_using_command log' -l log-size
1759complete -r -F -c git -n '__fish_git_using_command log' -s L -d 'Trace the evolution of the line range given by <start>,<end>, or regex <funcname>, within the <file>'
1760complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -s n -l max-count -d 'Limit the number of commits before starting to show the commit output'
1761complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l skip -d 'Skip given number of commits'
1762complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l since -d 'Show commits more recent than specified date'
1763complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l since-as-filter -d 'Show commits more recent than date without stopping traversal early'
1764complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l after -d 'Show commits more recent than specified date'
1765complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l until -d 'Show commits older than specified date'
1766complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l before -d 'Show commits older than specified date'
1767complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l author -d 'Limit commits from given author'
1768complete -x -c git -n '__fish_git_using_command log rev-list' -l committer -d 'Limit commits from given committer'
1769complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l grep-reflog -d 'Limit commits to ones with reflog entries matching given pattern'
1770complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l grep -d 'Limit commits with message that match given pattern'
1771complete -c git -n '__fish_git_using_command log shortlog rev-list' -l all-match -d 'Limit commits to ones that match all given --grep'
1772complete -c git -n '__fish_git_using_command log shortlog rev-list' -l invert-grep -d 'Limit commits to ones with message that don\'t match --grep'
1773complete -c git -n '__fish_git_using_command log shortlog rev-list' -l regexp-ignore-case -s i -d 'Case insensitive match'
1774complete -c git -n '__fish_git_using_command log shortlog rev-list' -l basic-regexp -d 'Patterns are basic regular expressions (default)'
1775complete -c git -n '__fish_git_using_command log shortlog rev-list' -l extended-regexp -s E -d 'Patterns are extended regular expressions'
1776complete -c git -n '__fish_git_using_command log shortlog rev-list' -l fixed-strings -s F -d 'Patterns are fixed strings'
1777complete -c git -n '__fish_git_using_command log shortlog rev-list' -l perl-regexp -d 'Patterns are Perl-compatible regular expressions'
1778complete -c git -n '__fish_git_using_command log shortlog rev-list' -l remove-empty -d 'Stop when given path disappears from tree'
1779complete -c git -n '__fish_git_using_command log shortlog rev-list' -l merges -d 'Print only merge commits'
1780complete -c git -n '__fish_git_using_command log shortlog rev-list' -l no-merges -d 'Don\'t print commits with more than one parent'
1781complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l min-parents -d 'Show only commit with at least the given number of parents'
1782complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l max-parents -d 'Show only commit with at most the given number of parents'
1783complete -c git -n '__fish_git_using_command log shortlog rev-list' -l no-min-parents -d 'Show only commit without a minimum number of parents'
1784complete -c git -n '__fish_git_using_command log shortlog rev-list' -l no-max-parents -d 'Show only commit without a maximum number of parents'
1785complete -c git -n '__fish_git_using_command log shortlog rev-list' -l first-parent -d 'Follow only the first parent commit upon seeing a merge commit'
1786complete -c git -n '__fish_git_using_command log shortlog rev-list' -l not -d 'Reverse meaning of ^ prefix'
1787complete -c git -n '__fish_git_using_command log shortlog rev-list' -l all -d 'Show log for all branches, tags, and remotes'
1788complete -f -c git -n '__fish_git_using_command log shortlog rev-list' -l branches -d 'Show log for all matching branches'
1789complete -f -c git -n '__fish_git_using_command log shortlog rev-list' -l tags -d 'Show log for all matching tags'
1790complete -f -c git -n '__fish_git_using_command log shortlog rev-list' -l remotes -d 'Show log for all matching remotes'
1791complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l glob -d 'Show log for all matching branches, tags, and remotes'
1792complete -x -c git -n '__fish_git_using_command log shortlog rev-list' -l exclude -d 'Do not include refs matching given glob pattern'
1793complete -c git -n '__fish_git_using_command log shortlog rev-list' -l reflog -d 'Show log for all reflogs entries'
1794complete -c git -n '__fish_git_using_command log shortlog rev-list' -l ignore-missing -d 'Ignore invalid object names'
1795complete -c git -n '__fish_git_using_command log shortlog rev-list' -l bisect
1796complete -c git -n '__fish_git_using_command log shortlog rev-list' -l stdin -d 'Read commits from stdin'
1797complete -c git -n '__fish_git_using_command log shortlog rev-list' -l cherry-mark -d 'Mark equivalent commits with = and inequivalent with +'
1798complete -c git -n '__fish_git_using_command log shortlog rev-list' -l cherry-pick -d 'Omit equivalent commits'
1799complete -f -c git -n '__fish_git_using_command rev-list' -l filter -ra '(__fish_git_filters)' -d 'Omits objects from the list of printed objects'
1800complete -c git -n '__fish_git_using_command log shortlog' -l left-only
1801complete -c git -n '__fish_git_using_command log shortlog' -l right-only
1802complete -c git -n '__fish_git_using_command log shortlog' -l cherry
1803complete -c git -n '__fish_git_using_command log shortlog' -l walk-reflogs -s g
1804complete -c git -n '__fish_git_using_command log shortlog' -l merge
1805complete -c git -n '__fish_git_using_command log shortlog' -l boundary
1806complete -c git -n '__fish_git_using_command log shortlog' -l simplify-by-decoration
1807complete -c git -n '__fish_git_using_command log shortlog' -l full-history
1808complete -c git -n '__fish_git_using_command log shortlog' -l dense
1809complete -c git -n '__fish_git_using_command log shortlog' -l sparse
1810complete -c git -n '__fish_git_using_command log shortlog' -l simplify-merges
1811complete -c git -n '__fish_git_using_command log shortlog' -l ancestry-path
1812complete -c git -n '__fish_git_using_command log shortlog' -l date-order
1813complete -c git -n '__fish_git_using_command log shortlog' -l author-date-order
1814complete -c git -n '__fish_git_using_command log shortlog' -l topo-order
1815complete -c git -n '__fish_git_using_command log shortlog' -l reverse
1816complete -f -c git -n '__fish_git_using_command log shortlog' -l no-walk -a "sorted unsorted"
1817complete -c git -n '__fish_git_using_command log shortlog' -l do-walk
1818complete -x -c git -n '__fish_git_using_command log shortlog' -l format -a '(__fish_git_show_opt format)' -d 'Pretty format string or preset name'
1819complete -c git -n '__fish_git_using_command log' -l abbrev-commit
1820complete -c git -n '__fish_git_using_command log' -l no-abbrev-commit
1821complete -c git -n '__fish_git_using_command log' -l oneline
1822complete -x -c git -n '__fish_git_using_command log' -l encoding -a '(__fish_print_encodings)'
1823complete -f -c git -n '__fish_git_using_command log' -l expand-tabs
1824complete -c git -n '__fish_git_using_command log' -l no-expand-tabs
1825complete -f -c git -n '__fish_git_using_command log' -l notes
1826complete -c git -n '__fish_git_using_command log' -l no-notes
1827complete -f -c git -n '__fish_git_using_command log' -l show-notes
1828complete -c git -n '__fish_git_using_command log' -l standard-notes
1829complete -c git -n '__fish_git_using_command log' -l no-standard-notes
1830complete -c git -n '__fish_git_using_command log' -l show-signature
1831complete -c git -n '__fish_git_using_command log' -l relative-date
1832complete -x -c git -n '__fish_git_using_command log shortlog' -l date -a '
1833    relative
1834    local
1835    iso
1836    iso-local
1837    iso8601
1838    iso8601-local
1839    iso-strict
1840    iso-strict-local
1841    iso8601-strict
1842    iso8601-strict-local
1843    rfc-local
1844    rfc2822-local
1845    short
1846    short-local
1847    raw
1848    human
1849    unix
1850    format:
1851    default
1852    default-local
1853'
1854complete -c git -n '__fish_git_using_command log' -l parents
1855complete -c git -n '__fish_git_using_command log' -l children
1856complete -c git -n '__fish_git_using_command log' -l left-right
1857complete -c git -n '__fish_git_using_command log' -l graph
1858complete -f -c git -n '__fish_git_using_command log' -l show-linear-break
1859complete -c git -n '__fish_git_using_command log' -s c
1860complete -c git -n '__fish_git_using_command log' -l cc
1861complete -c git -n '__fish_git_using_command log' -s m
1862complete -c git -n '__fish_git_using_command log' -s r
1863complete -c git -n '__fish_git_using_command log' -s t
1864complete -c git -n '__fish_git_using_command log' -l patch -s p
1865complete -c git -n '__fish_git_using_command log' -s u
1866complete -c git -n '__fish_git_using_command log' -l no-patch -s s
1867complete -x -c git -n '__fish_git_using_command log' -l unified -s U
1868complete -c git -n '__fish_git_using_command log' -l raw
1869complete -c git -n '__fish_git_using_command log' -l patch-with-raw
1870complete -c git -n '__fish_git_using_command log' -l indent-heuristic
1871complete -c git -n '__fish_git_using_command log' -l no-indent-heuristic
1872complete -c git -n '__fish_git_using_command log' -l compaction-heuristic
1873complete -c git -n '__fish_git_using_command log' -l no-compaction-heuristic
1874complete -c git -n '__fish_git_using_command log' -l minimal
1875complete -c git -n '__fish_git_using_command log' -l patience
1876complete -c git -n '__fish_git_using_command log' -l histogram
1877complete -f -x -c git -n '__fish_git_using_command log' -l stat
1878complete -c git -n '__fish_git_using_command log' -l numstat
1879complete -c git -n '__fish_git_using_command log' -l shortstat
1880complete -c git -n '__fish_git_using_command log' -l summary
1881complete -c git -n '__fish_git_using_command log' -l patch-with-stat
1882complete -c git -n '__fish_git_using_command log' -s z
1883complete -c git -n '__fish_git_using_command log' -l name-only
1884complete -c git -n '__fish_git_using_command log' -l name-status
1885complete -f -c git -n '__fish_git_using_command log' -l color -a 'always never auto'
1886complete -c git -n '__fish_git_using_command log' -l no-color
1887complete -f -c git -n '__fish_git_using_command log' -l word-diff -a '
1888    color
1889    plain
1890    porcelain
1891    none
1892'
1893complete -f -c git -n '__fish_git_using_command log' -l color-words
1894complete -c git -n '__fish_git_using_command log' -l no-renames
1895complete -c git -n '__fish_git_using_command log' -l check
1896complete -c git -n '__fish_git_using_command log' -l full-index
1897complete -c git -n '__fish_git_using_command log' -l binary
1898complete -f -c git -n '__fish_git_using_command log' -l abbrev
1899complete -f -c git -n '__fish_git_using_command log' -s l
1900
1901function __fish__git_append_letters_nosep
1902    set -l token (commandline -tc)
1903    printf "%s\n" $token$argv
1904end
1905
1906complete -x -c git -n '__fish_git_using_command log' -l diff-filter -a '(__fish__git_append_letters_nosep a\tExclude\ added c\tExclude\ copied d\tExclude\ deleted m\tExclude\ modified r\tExclude\ renamed t\tExclude\ type\ changed u\tExclude\ unmerged x\tExclude\ unknown b\tExclude\ broken A\tAdded C\tCopied D\tDeleted M\tModified R\tRenamed T\tType\ Changed U\tUnmerged X\tUnknown B\tBroken)'
1907
1908### ls-files
1909complete -c git -n __fish_git_needs_command -a ls-files -d 'Show information about files'
1910complete -c git -n '__fish_git_using_command ls-files'
1911complete -c git -n '__fish_git_using_command ls-files' -s c -l cached -d 'Show cached files in the output'
1912complete -c git -n '__fish_git_using_command ls-files' -s d -l deleted -d 'Show deleted files in the output'
1913complete -c git -n '__fish_git_using_command ls-files' -s m -l modified -d 'Show modified files in the output'
1914complete -c git -n '__fish_git_using_command ls-files' -s o -l others -d 'Show other (i.e. untracked) files in the output'
1915complete -c git -n '__fish_git_using_command ls-files' -s i -l ignored -d 'Show only ignored files in the output'
1916complete -c git -n '__fish_git_using_command ls-files' -s s -l stage -d "Show staged contents' mode bits, object name and stage number in the output"
1917complete -c git -n '__fish_git_using_command ls-files' -l directory -d 'If a whole directory is classified as "other", show just its name'
1918complete -c git -n '__fish_git_using_command ls-files' -l no-empty-directory -d 'Do not list empty directories'
1919complete -c git -n '__fish_git_using_command ls-files' -s u -l unmerged -d 'Show unmerged files in the output'
1920complete -c git -n '__fish_git_using_command ls-files' -s k -l killed -d 'Show files on the filesystem that need to be removed for checkout-index to succeed'
1921complete -c git -n '__fish_git_using_command ls-files' -s z -d 'Use \0 delimiter'
1922complete -c git -n '__fish_git_using_command ls-files' -s x -l exclude -d 'Skip untracked files matching pattern'
1923complete -c git -n '__fish_git_using_command ls-files' -s X -l exclude-from -d 'Read exclude patterns from <file>; 1 per line'
1924complete -c git -n '__fish_git_using_command ls-files' -l exclude-per-directory -d 'Read extra exclude patterns that apply only to the dir and its subdirs in <file>'
1925complete -c git -n '__fish_git_using_command ls-files' -l exclude-standard -d 'Add the standard Git exclusions'
1926complete -c git -n '__fish_git_using_command ls-files' -l error-unmatch -d 'If any <file> does not appear in the index, treat this as an error'
1927complete -c git -n '__fish_git_using_command ls-files' -l with-tree
1928complete -c git -n '__fish_git_using_command ls-files' -s t -d 'Identifies the file status'
1929complete -c git -n '__fish_git_using_command ls-files' -s v -d 'Show file status, use lowercase letters for files assumed unchanged'
1930complete -c git -n '__fish_git_using_command ls-files' -s f -d 'Show file status, use lowercase letters for files marked as fsmonitor valid'
1931complete -c git -n '__fish_git_using_command ls-files' -l full-name -d 'Force paths to be output relative to the project top directory'
1932complete -c git -n '__fish_git_using_command ls-files' -l recurse-submodules -d 'Recursively calls ls-files on each submodule in the repository'
1933complete -c git -n '__fish_git_using_command ls-files' -l abbrev -d 'Show only a partial prefix'
1934complete -c git -n '__fish_git_using_command ls-files' -l debug -d 'After each line that describes a file, add more data about its cache entry'
1935complete -c git -n '__fish_git_using_command ls-files' -l eol -d 'Show <eolinfo> and <eolattr> of files'
1936
1937### mailinfo
1938complete -f -c git -n __fish_git_needs_command -a mailinfo -d 'Extracts patch and authorship from an e-mail'
1939complete -f -c git -n '__fish_git_using_command mailinfo am' -s k -d 'Do not remove email cruft from subject'
1940complete -f -c git -n '__fish_git_using_command mailinfo' -s b -d 'Only strip bracket pairs containing \'PATCH\''
1941complete -f -c git -n '__fish_git_using_command mailinfo am' -s u -d 'Do not re-encode author name and email'
1942complete -x -c git -n '__fish_git_using_command mailinfo' -l encoding -d 'Re-encode to given charset'
1943complete -f -c git -n '__fish_git_using_command mailinfo' -s n -d 'Disable all charset re-encoding of metadata'
1944complete -f -c git -n '__fish_git_using_command mailinfo am' -s m -l message-id -d 'Copy message id to the end of commit message'
1945complete -f -c git -n '__fish_git_using_command mailinfo' -l scissors -d 'Remove everything above scissor line'
1946complete -f -c git -n '__fish_git_using_command mailinfo' -l no-scissors -d 'Ignore scissor lines'
1947complete -x -c git -n '__fish_git_using_command mailinfo' -l quoted-cr -a 'nowarn warn strip' -d 'Action when processed email message end with CRLF instead of LF'
1948
1949### mailsplit
1950complete -c git -n __fish_git_needs_command -a mailsplit -d 'mbox splitter'
1951complete -F -c git -n '__fish_git_using_command mailsplit' -s o -d 'Directory to place individual messages'
1952complete -f -c git -n '__fish_git_using_command mailsplit' -s b -d 'Treat files not starting with From line as single mail message'
1953complete -x -c git -n '__fish_git_using_command mailsplit' -s d -d 'File name prefix digit precision'
1954complete -x -c git -n '__fish_git_using_command mailsplit' -s f -d 'Skip first n numbers'
1955complete -f -c git -n '__fish_git_using_command mailsplit am' -l keep-cr -d 'Do not remove \\r from lines starting with \\n\\r'
1956complete -f -c git -n '__fish_git_using_command mailsplit' -l mboxrd -d 'Input is of mboxrd form'
1957
1958### maintenance
1959complete -f -c git -n __fish_git_needs_command -a maintenance -d 'Run tasks to optimize Git repository data'
1960complete -f -c git -n '__fish_git_using_command maintenance' -a register -d 'Initialize Git config vars for maintenance'
1961complete -f -c git -n '__fish_git_using_command maintenance' -a run -d 'Run one or more maintenance tasks'
1962complete -f -c git -n '__fish_git_using_command maintenance' -a start -d 'Start maintenance'
1963complete -f -c git -n '__fish_git_using_command maintenance' -a stop -d 'Halt background maintenance'
1964complete -f -c git -n '__fish_git_using_command maintenance' -a unregister -d 'Remove repository from background maintenance'
1965complete -f -c git -n '__fish_git_using_command maintenance' -l quiet -d 'Suppress logs'
1966complete -x -c git -n '__fish_git_using_command maintenance' -l task -a 'commit-graph prefetch gc loose-objects incremental-repack pack-refs' -d 'Tasks to run'
1967complete -f -c git -n '__fish_git_using_command maintenance' -l auto -d 'Run maintenance only when necessary'
1968complete -f -c git -n '__fish_git_using_command maintenance' -l schedule -d 'Run maintenance on certain intervals'
1969
1970### merge
1971complete -f -c git -n __fish_git_needs_command -a merge -d 'Join multiple development histories'
1972__fish_git_add_revision_completion -n '__fish_git_using_command merge'
1973complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
1974complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
1975complete -f -c git -n '__fish_git_using_command merge' -s e -l edit -d 'Edit auto-generated merge message'
1976complete -f -c git -n '__fish_git_using_command merge' -l no-edit -d "Don't edit auto-generated merge message"
1977complete -f -c git -n '__fish_git_using_command merge' -l ff -d "Don't generate a merge commit if merge is fast-forward"
1978complete -f -c git -n '__fish_git_using_command merge' -l no-ff -d "Generate a merge commit even if merge is fast-forward"
1979complete -f -c git -n '__fish_git_using_command merge' -l ff-only -d 'Refuse to merge unless fast-forward possible'
1980complete -f -c git -n '__fish_git_using_command merge' -s S -l gpg-sign -d 'GPG-sign the merge commit'
1981complete -f -c git -n '__fish_git_using_command merge' -l log -d 'Populate the log message with one-line descriptions'
1982complete -f -c git -n '__fish_git_using_command merge' -l no-log -d "Don't populate the log message with one-line descriptions"
1983complete -f -c git -n '__fish_git_using_command merge' -l signoff -d 'Add Signed-off-by line at the end of the merge commit message'
1984complete -f -c git -n '__fish_git_using_command merge' -l no-signoff -d 'Do not add a Signed-off-by line at the end of the merge commit message'
1985complete -f -c git -n '__fish_git_using_command merge' -l stat -d "Show diffstat of the merge"
1986complete -f -c git -n '__fish_git_using_command merge' -s n -l no-stat -d "Don't show diffstat of the merge"
1987complete -f -c git -n '__fish_git_using_command merge' -l squash -d "Squash changes from other branch as a single commit"
1988complete -f -c git -n '__fish_git_using_command merge' -l no-squash -d "Don't squash changes"
1989complete -x -c git -n '__fish_git_using_command merge' -s s -l strategy -d 'Use the given merge strategy'
1990complete -r -c git -n '__fish_git_using_command merge' -s X -l strategy-option -d 'Pass given option to the merge strategy'
1991complete -f -c git -n '__fish_git_using_command merge' -l verify-signatures -d 'Abort merge if other branch tip commit is not signed with a valid key'
1992complete -f -c git -n '__fish_git_using_command merge' -l no-verify-signatures -d 'Do not abort merge if other branch tip commit is not signed with a valid key'
1993complete -f -c git -n '__fish_git_using_command merge' -s q -l quiet -d 'Be quiet'
1994complete -f -c git -n '__fish_git_using_command merge' -s v -l verbose -d 'Be verbose'
1995complete -f -c git -n '__fish_git_using_command merge' -l progress -d 'Force progress status'
1996complete -f -c git -n '__fish_git_using_command merge' -l no-progress -d 'Force no progress status'
1997complete -f -c git -n '__fish_git_using_command merge' -l allow-unrelated-histories -d 'Allow merging even when branches do not share a common history'
1998complete -x -c git -n '__fish_git_using_command merge' -s m -d 'Set the commit message'
1999complete -f -c git -n '__fish_git_using_command merge' -l rerere-autoupdate -d 'If possible, use previous conflict resolutions'
2000complete -f -c git -n '__fish_git_using_command merge' -l no-rerere-autoupdate -d 'Do not use previous conflict resolutions'
2001complete -f -c git -n '__fish_git_using_command merge' -l abort -d 'Abort the current conflict resolution process'
2002complete -f -c git -n '__fish_git_using_command merge' -l continue -d 'Conclude current conflict resolution process'
2003complete -f -c git -n '__fish_git_using_command merge' -l autostash -d 'Before starting merge, stash local changes, and apply stash when done'
2004complete -f -c git -n '__fish_git_using_command merge' -l no-autostash -d 'Do not stash local changes before starting merge'
2005
2006### merge-base
2007complete -f -c git -n __fish_git_needs_command -a merge-base -d 'Find a common ancestor for a merge'
2008__fish_git_add_revision_completion -n '__fish_git_using_command merge-base'
2009complete -f -c git -n '__fish_git_using_command merge-base' -s a -l all -d 'Output all merge bases for the commits, instead of just one'
2010complete -f -c git -n '__fish_git_using_command merge-base' -l octopus -d 'Compute the best common ancestors of all supplied commits'
2011complete -f -c git -n '__fish_git_using_command merge-base' -l independent -d 'Print a minimal subset of the supplied commits with the same ancestors'
2012complete -f -c git -n '__fish_git_using_command merge-base' -l is-ancestor -d 'Check if the first commit is an ancestor of the second commit'
2013complete -f -c git -n '__fish_git_using_command merge-base' -l fork-point -d 'Find the point at which a branch forked from another branch ref'
2014
2015### mergetool
2016
2017complete -f -c git -n __fish_git_needs_command -a mergetool -d 'Run merge conflict resolution tool'
2018complete -f -c git -n '__fish_git_using_command mergetool' -s t -l tool -d "Use specific merge resolution program" -a "(__fish_git_diffmerge_tools mergetool)"
2019complete -f -c git -n '__fish_git_using_command mergetool' -l tool-help -d 'Print a list of merge tools that may be used with `--tool`'
2020complete -f -c git -n '__fish_git_using_command mergetool' -a "(__fish_git_files unmerged)"
2021complete -f -c git -n '__fish_git_using_command mergetool' -s y -l no-prompt -d 'Do not prompt before launching a diff tool'
2022complete -f -c git -n '__fish_git_using_command mergetool' -l prompt -d 'Prompt before each invocation of the merge resolution program'
2023complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files in the order specified in the file passed as argument'
2024
2025### mv
2026complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file'
2027complete -f -c git -n '__fish_git_using_command mv' -a '(__fish_git ls-files)'
2028complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rename/moving even if target exists'
2029complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move which can lead to error'
2030complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only show what would happen'
2031complete -f -c git -n '__fish_git_using_command mv' -s v -l verbose -d 'Report names of files as they are changed'
2032
2033### notes
2034set -l notescommands add copy append edit show merge remove # list prune get-ref
2035complete -c git -n __fish_git_needs_command -a notes -d 'Add or inspect object notes'
2036complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a list -d 'List notes for given object'
2037complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a add -d 'Add notes for a given object'
2038complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a copy -d 'Copy notes from object1 to object2'
2039complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a append -d 'Append to the notes of existing object'
2040complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a edit -d 'Edit notes for a given object'
2041complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a show -d 'Show notes for given object'
2042complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a merge -d 'Merge the given notes ref to current notes ref'
2043complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a remove -d 'Remove notes for given object'
2044complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a prune -d 'Remove notes for non-existing/unreachable objects'
2045complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a get-ref -d 'Print current notes ref'
2046complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from $notescommands" -ka '(__fish_git_commits)'
2047complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add copy" -s f -l force -d 'Overwrite existing notes'
2048complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append edit" -l allow-empty -d 'Allow empty note'
2049complete -r -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s F -l file -d 'Read note message from file'
2050complete -x -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s m -l message -d 'Use this note message'
2051complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s C -l reuse-message -a '(__fish_git_commits)' -d 'Copy note from object'
2052complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s c -l reedit-message -a '(__fish_git_commits)' -d 'Copy and edit note from object'
2053complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from copy remove" -l stdin -d 'Read object names from stdin'
2054complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge remove prune" -s v -l verbose -d 'Be more verbose'
2055complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge remove prune" -s q -l quiet -d 'Operate quietly'
2056complete -x -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -s s -l strategy -d 'Merge strategy to use to resolve conflicts' -a "
2057    manual\t'Instruct the user to resolve merge conflicts'
2058    ours\t'Resolve conflicts in favour of local version'
2059    theirs\t'Resolve conflicts in favour of remote version'
2060    union\t'Resolve conflicts by concatenating local and remote versions'
2061    cat_sort_uniq\t'Concatenate, sort and remove duplicate lines'
2062"
2063complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -l commit -d 'Finalize git notes merge'
2064complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -l abort -d 'Abort git notes merge'
2065complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from remove" -l ignore-missing -d 'Do not throw error on deleting non-existing object note'
2066
2067### prune
2068complete -f -c git -n __fish_git_needs_command -a prune -d 'Prune unreachable objects from the database'
2069complete -f -c git -n '__fish_git_using_command prune' -s n -l dry-run -d 'Just report what it would remove'
2070complete -f -c git -n '__fish_git_using_command prune' -s v -l verbose -d 'Report all removed objects'
2071complete -f -c git -n '__fish_git_using_command prune' -l progress -d 'Show progress'
2072complete -x -c git -n '__fish_git_using_command prune' -l expire -d 'Only expire loose objects older than date'
2073
2074### pull
2075complete -f -c git -n __fish_git_needs_command -a pull -d 'Fetch from and merge with another repo or branch'
2076complete -f -c git -n '__fish_git_using_command pull' -s q -l quiet -d 'Be quiet'
2077complete -f -c git -n '__fish_git_using_command pull' -s v -l verbose -d 'Be verbose'
2078# Options related to fetching
2079complete -f -c git -n '__fish_git_using_command pull' -l all -d 'Fetch all remotes'
2080complete -f -c git -n '__fish_git_using_command pull' -s a -l append -d 'Append ref names and object names'
2081complete -f -c git -n '__fish_git_using_command pull' -s f -l force -d 'Force update of local branches'
2082complete -f -c git -n '__fish_git_using_command pull' -s k -l keep -d 'Keep downloaded pack'
2083complete -f -c git -n '__fish_git_using_command pull' -l no-tags -d 'Disable automatic tag following'
2084complete -f -c git -n '__fish_git_using_command pull' -s p -l prune -d 'Remove remote-tracking references that no longer exist on the remote'
2085# TODO --upload-pack
2086complete -f -c git -n '__fish_git_using_command pull' -l progress -d 'Force progress status'
2087complete -f -c git -n '__fish_git_using_command pull' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
2088complete -f -c git -n '__fish_git_using_command pull' -n __fish_git_branch_for_remote -ka '(__fish_git_branch_for_remote)'
2089# Options related to merging
2090complete -f -c git -n '__fish_git_using_command pull' -l commit -d "Autocommit the merge"
2091complete -f -c git -n '__fish_git_using_command pull' -l no-commit -d "Don't autocommit the merge"
2092complete -f -c git -n '__fish_git_using_command pull' -s e -l edit -d 'Edit auto-generated merge message'
2093complete -f -c git -n '__fish_git_using_command pull' -l no-edit -d "Don't edit auto-generated merge message"
2094complete -f -c git -n '__fish_git_using_command pull' -l ff -d "Don't generate a merge commit if merge is fast-forward"
2095complete -f -c git -n '__fish_git_using_command pull' -l no-ff -d "Generate a merge commit even if merge is fast-forward"
2096complete -f -c git -n '__fish_git_using_command pull' -l ff-only -d 'Refuse to merge unless fast-forward possible'
2097complete -f -c git -n '__fish_git_using_command pull' -s S -l gpg-sign -d 'GPG-sign the merge commit'
2098complete -f -c git -n '__fish_git_using_command pull' -l log -d 'Populate the log message with one-line descriptions'
2099complete -f -c git -n '__fish_git_using_command pull' -l no-log -d "Don't populate the log message with one-line descriptions"
2100complete -f -c git -n '__fish_git_using_command pull' -l signoff -d 'Add Signed-off-by line at the end of the merge commit message'
2101complete -f -c git -n '__fish_git_using_command pull' -l no-signoff -d 'Do not add a Signed-off-by line at the end of the merge commit message'
2102complete -f -c git -n '__fish_git_using_command pull' -l stat -d "Show diffstat of the merge"
2103complete -f -c git -n '__fish_git_using_command pull' -s n -l no-stat -d "Don't show diffstat of the merge"
2104complete -f -c git -n '__fish_git_using_command pull' -l squash -d "Squash changes from upstream branch as a single commit"
2105complete -f -c git -n '__fish_git_using_command pull' -l no-squash -d "Don't squash changes"
2106complete -x -c git -n '__fish_git_using_command pull' -s s -l strategy -d 'Use the given merge strategy'
2107complete -r -c git -n '__fish_git_using_command pull' -s X -l strategy-option -d 'Pass given option to the merge strategy'
2108complete -f -c git -n '__fish_git_using_command pull' -l verify-signatures -d 'Abort merge if upstream branch tip commit is not signed with a valid key'
2109complete -f -c git -n '__fish_git_using_command pull' -l no-verify-signatures -d 'Do not abort merge if upstream branch tip commit is not signed with a valid key'
2110complete -f -c git -n '__fish_git_using_command pull' -l allow-unrelated-histories -d 'Allow merging even when branches do not share a common history'
2111complete -f -c git -n '__fish_git_using_command pull' -s r -l rebase -d 'Rebase the current branch on top of the upstream branch'
2112complete -f -c git -n '__fish_git_using_command pull' -l no-rebase -d 'Do not rebase the current branch on top of the upstream branch'
2113complete -f -c git -n '__fish_git_using_command pull' -l autostash -d 'Before starting rebase, stash local changes, and apply stash when done'
2114complete -f -c git -n '__fish_git_using_command pull' -l no-autostash -d 'Do not stash local changes before starting rebase'
2115complete -f -c git -n '__fish_git_using_command pull' -l verify -d 'Allow the pre-merge and commit-msg hooks to run (default)'
2116complete -f -c git -n '__fish_git_using_command pull' -l no-verify -d 'Do not run pre-merge and commit-msg hooks'
2117complete -x -c git -n '__fish_git_using_command pull' -l upload-pack -d 'Path to git-upload-pack on remote'
2118complete -x -c git -n '__fish_git_using_command pull' -l depth -d 'Limit fetching to specified number of commits'
2119complete -x -c git -n '__fish_git_using_command pull' -l deepen -d 'Deepen history of shallow repository by specified commits'
2120complete -x -c git -n '__fish_git_using_command pull' -l shallow-since -d 'Deepen history after specified date'
2121complete -x -c git -n '__fish_git_using_command pull' -l shallow-exclude -d 'Deepen history excluding commits reachable from branch'
2122complete -f -c git -n '__fish_git_using_command pull' -l unshallow -d 'Convert shallow repository to complete one'
2123complete -f -c git -n '__fish_git_using_command pull' -l update-shallow -d 'Accept refs that update .git/shallow'
2124complete -x -c git -n '__fish_git_using_command pull' -s j -l jobs -d 'Number of parallel children for fetching'
2125complete -f -c git -n '__fish_git_using_command pull' -s 4 -l ipv4 -d 'Use IPv4 addresses only'
2126complete -f -c git -n '__fish_git_using_command pull' -s 6 -l ipv6 -d 'Use IPv6 addresses only'
2127
2128### range-diff
2129complete -f -c git -n __fish_git_needs_command -a range-diff -d 'Compare two commit ranges'
2130complete -f -c git -n '__fish_git_using_command range-diff' -ka '(__fish_git_ranges)'
2131complete -f -c git -n '__fish_git_using_command range-diff' -l creation-factor -d 'Percentage by which creation is weighted'
2132complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d 'Use simple diff colors'
2133
2134### push
2135complete -f -c git -n __fish_git_needs_command -a push -d 'Push changes elsewhere'
2136complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
2137begin
2138    set -lx __fish_git_filter_non_pushable '| string replace -r "(\t.*)?\$" ":\$1"'
2139    __fish_git_add_revision_completion -n '__fish_git_using_command push' -n __fish_git_branch_for_remote
2140end
2141# The "refspec" here is an optional "+" to signify a force-push
2142complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q "+*" -- (commandline -ct)' -ka '+(__fish_git_branches | string replace -r \t".*" "")' -d 'Force-push branch'
2143# git push REMOTE :BRANCH deletes BRANCH on remote REMOTE
2144complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q ":*" -- (commandline -ct)' -ka ':(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Delete remote branch'
2145# then src:dest (where both src and dest are git objects, so we want to complete branches)
2146complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q "+*:*" -- (commandline -ct)' -ka '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Force-push local branch to remote branch'
2147complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q "*:*" -- (commandline -ct)' -ka '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Push local branch to remote branch'
2148complete -f -c git -n '__fish_git_using_command push' -l all -d 'Push all refs under refs/heads/'
2149complete -f -c git -n '__fish_git_using_command push' -l prune -d "Remove remote branches that don't have a local counterpart"
2150complete -f -c git -n '__fish_git_using_command push' -l mirror -d 'Push all refs under refs/'
2151complete -f -c git -n '__fish_git_using_command push' -l delete -d 'Delete all listed refs from the remote repository'
2152complete -f -c git -n '__fish_git_using_command push' -l tags -d 'Push all refs under refs/tags'
2153complete -f -c git -n '__fish_git_using_command push' -l follow-tags -d 'Push all usual refs plus the ones under refs/tags'
2154complete -f -c git -n '__fish_git_using_command push' -s n -l dry-run -d 'Do everything except actually send the updates'
2155complete -f -c git -n '__fish_git_using_command push' -l porcelain -d 'Produce machine-readable output'
2156complete -f -c git -n '__fish_git_using_command push' -s f -l force -d 'Force update of remote refs'
2157complete -f -c git -n '__fish_git_using_command push' -l force-with-lease -d 'Force update of remote refs, stopping if other\'s changes would be overwritten'
2158complete -f -c git -n '__fish_git_using_command push' -l force-if-includes -d 'Force an update only if the tip of the remote-tracking ref has been integrated locally'
2159complete -f -c git -n '__fish_git_using_command push' -s u -l set-upstream -d 'Add upstream (tracking) reference'
2160complete -f -c git -n '__fish_git_using_command push' -s q -l quiet -d 'Be quiet'
2161complete -f -c git -n '__fish_git_using_command push' -s v -l verbose -d 'Be verbose'
2162complete -f -c git -n '__fish_git_using_command push' -l progress -d 'Force progress status'
2163complete -f -c git -n '__fish_git_using_command push' -l verify -d 'Allow the pre-push hook to run (default)'
2164complete -f -c git -n '__fish_git_using_command push' -l no-verify -d 'Do not run the pre-push hook'
2165complete -x -c git -n '__fish_git_using_command push' -l recurse-submodules -a 'check on-demand only no' -d 'Control recursive pushing of submodules'
2166complete -f -c git -n '__fish_git_using_command push' -l signed -d 'GPG-sign the push'
2167complete -f -c git -n '__fish_git_using_command push' -l no-signed -d 'Do not GPG-sign the push'
2168complete -f -c git -n '__fish_git_using_command push' -l atomic -d 'Request atomic transaction on remote side'
2169complete -f -c git -n '__fish_git_using_command push' -l no-atomic -d 'Do not request atomic transaction'
2170complete -f -c git -n '__fish_git_using_command push' -l thin -d 'Spend extra cycles to minimize number of objects'
2171complete -f -c git -n '__fish_git_using_command push' -l no-thin -d 'Do not use thin pack'
2172complete -f -c git -n '__fish_git_using_command push' -s 4 -l ipv4 -d 'Use IPv4 addresses only'
2173complete -f -c git -n '__fish_git_using_command push' -s 6 -l ipv6 -d 'Use IPv6 addresses only'
2174complete -x -c git -n '__fish_git_using_command push' -s o -l push-option -d 'Transmit string to server'
2175complete -x -c git -n '__fish_git_using_command push' -l repo -d 'Override configured repository'
2176complete -x -c git -n '__fish_git_using_command push' -l receive-pack -d 'Path to git-receive-pack on remote'
2177complete -x -c git -n '__fish_git_using_command push' -l exec -d 'Same as --receive-pack'
2178
2179### rebase
2180complete -f -c git -n __fish_git_needs_command -a rebase -d 'Reapply commit sequence on a new base'
2181__fish_git_add_revision_completion -n '__fish_git_using_command rebase'
2182complete -f -c git -n '__fish_git_using_command rebase' -n 'string match -rq -- "^-i|^--interactive" (commandline -xpc)' -ka '(__fish_git_recent_commits)'
2183complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l continue -d 'Restart the rebasing process'
2184complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l abort -d 'Abort the rebase operation'
2185complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l edit-todo -d 'Edit the todo list'
2186complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l skip -d 'Restart the rebasing process by skipping the current patch'
2187complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l show-current-patch -d 'Show the patch file being applied or merged'
2188complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l quit -d 'Abort the rebase operation but keep HEAD where it is'
2189complete -f -c git -n '__fish_git_using_command rebase' -l keep-empty -d "Keep the commits that don't change anything"
2190complete -f -c git -n '__fish_git_using_command rebase' -l keep-base -d 'Keep the base commit as-is'
2191complete -f -c git -n '__fish_git_using_command rebase' -s m -l merge -d 'Use merging strategies to rebase'
2192complete -f -c git -n '__fish_git_using_command rebase' -s q -l quiet -d 'Be quiet'
2193complete -f -c git -n '__fish_git_using_command rebase' -s v -l verbose -d 'Be verbose'
2194complete -f -c git -n '__fish_git_using_command rebase' -l stat -d "Show diffstat of the rebase"
2195complete -f -c git -n '__fish_git_using_command rebase' -s n -l no-stat -d "Don't show diffstat of the rebase"
2196complete -f -c git -n '__fish_git_using_command rebase' -l verify -d "Allow the pre-rebase hook to run"
2197complete -f -c git -n '__fish_git_using_command rebase' -l no-verify -d "Don't allow the pre-rebase hook to run"
2198complete -f -c git -n '__fish_git_using_command rebase' -s f -l force-rebase -d 'Force the rebase'
2199complete -f -c git -n '__fish_git_using_command rebase' -l committer-date-is-author-date -d "Use the author date as the committer date"
2200complete -f -c git -n '__fish_git_using_command rebase' -l ignore-date -d "Use the committer date as the author date"
2201complete -f -c git -n '__fish_git_using_command rebase' -s i -l interactive -d 'Interactive mode'
2202complete -f -c git -n '__fish_git_using_command rebase' -s p -l preserve-merges -d 'Try to recreate merges'
2203complete -f -c git -n '__fish_git_using_command rebase' -s r -l rebase-merges -a 'rebase-cousins no-rebase-cousins' -d 'Preserve branch structure'
2204complete -f -c git -n '__fish_git_using_command rebase' -l root -d 'Rebase all reachable commits'
2205complete -f -c git -n '__fish_git_using_command rebase' -l autosquash -d 'Automatic squashing'
2206complete -f -c git -n '__fish_git_using_command rebase' -l no-autosquash -d 'No automatic squashing'
2207complete -f -c git -n '__fish_git_using_command rebase' -l autostash -d 'Before starting rebase, stash local changes, and apply stash when done'
2208complete -f -c git -n '__fish_git_using_command rebase' -l no-autostash -d 'Do not stash local changes before starting rebase'
2209complete -f -c git -n '__fish_git_using_command rebase' -l no-ff -d 'No fast-forward'
2210__fish_git_add_revision_completion -n '__fish_git_using_command rebase' -l onto -d 'Rebase current branch onto given upstream or newbase' -r
2211complete -f -c git -n '__fish_git_using_command rebase' -l update-refs -d 'Update any branches that point to commits being rebased'
2212complete -f -c git -n '__fish_git_using_command rebase' -l no-update-refs -d 'Don\'t update any branches that point to commits being rebased'
2213# This actually takes script for $SHELL, but completing that is... complicated.
2214complete -r -c git -n '__fish_git_using_command rebase' -l exec -d 'Execute shellscript'
2215
2216### reflog
2217set -l reflogcommands show expire delete exists
2218complete -f -c git -n __fish_git_needs_command -a reflog -d 'Manage reflog information'
2219complete -f -c git -n '__fish_git_using_command reflog' -ka '(__fish_git_branches)'
2220complete -f -c git -n '__fish_git_using_command reflog' -ka '(__fish_git_heads)' -d Head
2221
2222complete -f -c git -n "__fish_git_using_command reflog" -n "not __fish_seen_subcommand_from $reflogcommands" -a "$reflogcommands"
2223
2224### reset
2225complete -c git -n __fish_git_needs_command -a reset -d 'Reset current HEAD to the specified state'
2226complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset the index and the working tree'
2227complete -f -c git -n '__fish_git_using_command reset' -l soft -d 'Reset head without touching the index or the working tree'
2228complete -f -c git -n '__fish_git_using_command reset' -l mixed -d 'The default: reset the index but not the working tree'
2229__fish_git_add_revision_completion -n '__fish_git_using_command reset'
2230# reset can either undo changes to versioned modified files,
2231# or remove files from the staging area.
2232# Deleted files seem to need a "--" separator.
2233complete -f -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_files all-staged modified)'
2234complete -F -c git -n '__fish_git_using_command reset' -n 'contains -- -- (commandline -xpc)'
2235complete -f -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_reflog)' -d Reflog
2236complete -f -c git -n '__fish_git_using_command reset' -s q -l quiet -d 'Be quiet, only report errors'
2237complete -f -c git -n '__fish_git_using_command reset' -s p -l patch -d 'Interactively select hunks to reset'
2238complete -f -c git -n '__fish_git_using_command reset' -l merge -d 'Reset index and update files in working tree that differ'
2239complete -f -c git -n '__fish_git_using_command reset' -l keep -d 'Reset index but keep changes in working tree'
2240complete -F -c git -n '__fish_git_using_command reset' -l pathspec-from-file -d 'Read pathspec from file'
2241complete -f -c git -n '__fish_git_using_command reset' -l pathspec-file-nul -d 'NUL separator for pathspec-from-file'
2242
2243### restore and switch
2244# restore options
2245complete -f -c git -n __fish_git_needs_command -a restore -d 'Restore working tree files'
2246complete -f -c git -n '__fish_git_using_command restore' -r -s s -l source -d 'Specify the source tree used to restore the working tree' -ka '(__fish_git_refs)'
2247complete -f -c git -n '__fish_git_using_command restore' -s p -l patch -d 'Interactive mode'
2248complete -f -c git -n '__fish_git_using_command restore' -s W -l worktree -d 'Restore working tree (default)'
2249complete -f -c git -n '__fish_git_using_command restore' -s S -l staged -d 'Restore the index'
2250complete -f -c git -n '__fish_git_using_command restore' -l ours -d 'When restoring files, use stage #2 (ours)'
2251complete -f -c git -n '__fish_git_using_command restore' -l theirs -d 'When restoring files, use stage #3 (theirs)'
2252complete -f -c git -n '__fish_git_using_command restore' -s m -l merge -d 'Recreate the conflicted merge in the unmerged paths when restoring files'
2253complete -f -c git -n '__fish_git_using_command restore' -l ignore-unmerged -d 'When restoring files, do not abort the operation if there are unmerged entries'
2254complete -f -c git -n '__fish_git_using_command restore' -l ignore-skip-worktree-bits -d 'Ignore the sparse-checkout file and unconditionally restore any files in <pathspec>'
2255complete -f -c git -n '__fish_git_using_command restore' -l overlay -d 'Never remove files when restoring'
2256complete -f -c git -n '__fish_git_using_command restore' -l no-overlay -d 'Remove files when restoring (default)'
2257complete -f -c git -n '__fish_git_using_command restore' -n 'not __fish_git_contains_opt -s S staged' -a '(__fish_git_files modified deleted modified-staged-deleted)'
2258complete -f -c git -n '__fish_git_using_command restore' -n '__fish_git_contains_opt -s S staged' -a '(__fish_git_files added modified-staged deleted-staged renamed copied unmerged)'
2259complete -F -c git -n '__fish_git_using_command restore' -n '__fish_git_contains_opt -s s source'
2260# switch options
2261complete -f -c git -n __fish_git_needs_command -a switch -d 'Switch to a branch'
2262complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
2263complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branches)'
2264complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
2265complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
2266begin
2267    set -lx __fish_git_recent_commits_arg --all
2268    __fish_git_add_revision_completion -n '__fish_git_using_command switch' -s d -l detach -r
2269end
2270complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
2271complete -f -c git -n '__fish_git_using_command switch' -l guess -d 'Guess branch name from remote branch (default)'
2272complete -f -c git -n '__fish_git_using_command switch' -l no-guess -d 'Do not guess branch name from remote branch'
2273complete -f -c git -n '__fish_git_using_command switch' -s f -l force -l discard-changes -d 'Proceed even if the index or the working tree differs from HEAD'
2274complete -f -c git -n '__fish_git_using_command switch' -s m -l merge -d 'Merge the current branch and contents of the working tree into a new branch'
2275complete -f -c git -n '__fish_git_using_command switch' -s t -l track -d 'Track remote branch when creating a new branch'
2276complete -f -c git -n '__fish_git_using_command switch' -l no-track -d 'Do not track remote branch when creating a new branch'
2277complete -f -c git -n '__fish_git_using_command switch' -r -l orphan -d 'Create a new orphan branch'
2278complete -f -c git -n '__fish_git_using_command switch' -l ignore-other-worktrees -d 'Force check out of the reference'
2279complete -f -c git -n '__fish_git_using_command switch' -l recurse-submodules -d 'Update the work trees of submodules'
2280complete -f -c git -n '__fish_git_using_command switch' -l no-recurse-submodules -d 'Do not update the work trees of submodules'
2281# common options
2282complete -f -c git -n '__fish_git_using_command restore switch' -s q -l quiet -d 'Suppress messages'
2283complete -f -c git -n '__fish_git_using_command restore switch' -l progress -d 'Report progress status to stderr (default)'
2284complete -f -c git -n '__fish_git_using_command restore switch' -l no-progress -d 'Do not report progress status to stderr'
2285complete -f -c git -n '__fish_git_using_command restore switch' -l 'conflict=merge' -d 'Same as --merge, but specify \'merge\' as the conflicting hunk style (default)'
2286complete -f -c git -n '__fish_git_using_command restore switch' -l 'conflict=diff3' -d 'Same as --merge, but specify \'diff3\' as the conflicting hunk style'
2287
2288### rev-list
2289# (options see log)
2290complete -f -c git -n __fish_git_needs_command -a rev-list -d 'List commits in chronological order'
2291
2292### rev-parse
2293complete -f -c git -n __fish_git_needs_command -a rev-parse -d 'Parse revision names or give repo information'
2294__fish_git_add_revision_completion -n '__fish_git_using_command rev-parse'
2295complete -c git -n '__fish_git_using_command rev-parse' -l abbrev-ref -d 'Output non-ambiguous short object names'
2296complete -c git -n '__fish_git_using_command rev-parse' -l is-inside-git-dir -d 'Print whether the current working directory is in the .git directory'
2297complete -c git -n '__fish_git_using_command rev-parse' -l is-inside-work-tree -d 'Print whether the current working directory is in the work tree of the repository'
2298
2299### revert
2300complete -f -c git -n __fish_git_needs_command -a revert -d 'Revert an existing commit'
2301complete -f -c git -n '__fish_git_using_command revert' -ka '(__fish_git_commits)'
2302complete -f -c git -n '__fish_git_using_command revert' -l continue -d 'Continue the operation in progress'
2303complete -f -c git -n '__fish_git_using_command revert' -l abort -d 'Cancel the operation'
2304complete -f -c git -n '__fish_git_using_command revert' -l skip -d 'Skip the current commit and continue with the rest of the sequence'
2305complete -f -c git -n '__fish_git_using_command revert' -l quit -d 'Forget about the current operation in progress'
2306complete -f -c git -n '__fish_git_using_command revert' -l no-edit -d 'Do not start the commit message editor'
2307complete -f -c git -n '__fish_git_using_command revert' -s n -l no-commit -d 'Apply changes to index but don\'t create a commit'
2308complete -f -c git -n '__fish_git_using_command revert' -s s -l signoff -d 'Add a Signed-off-by trailer at the end of the commit message'
2309complete -f -c git -n '__fish_git_using_command revert' -l rerere-autoupdate -d 'Allow the rerere mechanism to update the index automatically'
2310complete -f -c git -n '__fish_git_using_command revert' -l no-rerere-autoupdate -d 'Prevent the rerere mechanism from updating the index with auto-conflict resolution'
2311complete -f -c git -n '__fish_git_using_command revert' -l abort -d 'Cancel the operation and return to pre-sequence state'
2312complete -f -c git -n '__fish_git_using_command revert' -l continue -d 'Continue the operation after resolving conflicts'
2313complete -f -c git -n '__fish_git_using_command revert' -l quit -d 'Clear the sequencer state after a failed revert'
2314complete -f -c git -n '__fish_git_using_command revert' -l skip -d 'Skip the current commit and continue with the rest'
2315complete -f -c git -n '__fish_git_using_command revert' -s e -l edit -d 'Edit the commit message before committing'
2316complete -f -c git -n '__fish_git_using_command revert' -l no-edit -d 'Do not edit the commit message'
2317complete -x -c git -n '__fish_git_using_command revert' -s m -l mainline -d 'Select parent number for reverting merge commits'
2318complete -x -c git -n '__fish_git_using_command revert' -s S -l gpg-sign -a '(type -q gpg && __fish_complete_gpg_key_id gpg)' -d 'GPG-sign commits'
2319complete -f -c git -n '__fish_git_using_command revert' -l no-gpg-sign -d 'Do not GPG-sign commits'
2320complete -x -c git -n '__fish_git_using_command revert' -s s -l strategy -d 'Use the given merge strategy'
2321complete -x -c git -n '__fish_git_using_command revert' -s X -l strategy-option -d 'Pass option to the merge strategy'
2322
2323### rm
2324complete -c git -n __fish_git_needs_command -a rm -d 'Remove files from the working tree and/or staging area'
2325complete -c git -n '__fish_git_using_command rm' -l cached -d 'Unstage files from the index'
2326complete -c git -n '__fish_git_using_command rm' -n '__fish_git_contains_opt cached' -f -a '(__fish_git_files all-staged)'
2327complete -c git -n '__fish_git_using_command rm' -l ignore-unmatch -d 'Exit with a zero status even if no files matched'
2328complete -c git -n '__fish_git_using_command rm' -s r -d 'Allow recursive removal'
2329complete -c git -n '__fish_git_using_command rm' -s q -l quiet -d 'Be quiet'
2330complete -c git -n '__fish_git_using_command rm' -s f -l force -d 'Override the up-to-date check'
2331complete -c git -n '__fish_git_using_command rm' -s n -l dry-run -d 'Dry run'
2332complete -c git -n '__fish_git_using_command rm' -l sparse -d 'Allow updating index entries outside of the sparse-checkout cone'
2333complete -F -c git -n '__fish_git_using_command rm' -l pathspec-from-file -d 'Read pathspec from file'
2334complete -f -c git -n '__fish_git_using_command rm' -l pathspec-file-nul -d 'NUL separator for pathspec-from-file'
2335
2336### status
2337complete -f -c git -n __fish_git_needs_command -a status -d 'Show the working tree status'
2338complete -f -c git -n '__fish_git_using_command status' -s s -l short -d 'Give the output in the short-format'
2339complete -f -c git -n '__fish_git_using_command status' -s b -l branch -d 'Show the branch and tracking info even in short-format'
2340complete -f -c git -n '__fish_git_using_command status' -l porcelain -d 'Give the output in a stable, easy-to-parse format'
2341complete -f -c git -n '__fish_git_using_command status' -s z -d 'Terminate entries with null character'
2342complete -f -c git -n '__fish_git_using_command status' -s u -l untracked-files -x -a 'no normal all' -d 'The untracked files handling mode'
2343complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x -a 'none untracked dirty all' -d 'Ignore changes to submodules'
2344complete -f -c git -n '__fish_git_using_command status' -s v -l verbose -d 'Also show the textual changes that are staged to be committed'
2345complete -f -c git -n '__fish_git_using_command status' -l no-ahead-behind -d 'Do not display detailed ahead/behind upstream-branch counts'
2346complete -f -c git -n '__fish_git_using_command status' -l renames -d 'Turn on rename detection regardless of user configuration'
2347complete -f -c git -n '__fish_git_using_command status' -l no-renames -d 'Turn off rename detection regardless of user configuration'
2348complete -f -c git -n '__fish_git_using_command status' -l ahead-behind -d 'Display detailed ahead/behind upstream-branch counts'
2349complete -f -c git -n '__fish_git_using_command status' -l long -d 'Give the output in the long-format (default)'
2350complete -f -c git -n '__fish_git_using_command status' -l show-stash -d 'Show the number of entries currently stashed'
2351complete -x -c git -n '__fish_git_using_command status' -l column -d 'Display untracked files in columns'
2352complete -f -c git -n '__fish_git_using_command status' -l no-column -d 'Do not display untracked files in columns'
2353complete -F -c git -n '__fish_git_using_command status' -l pathspec-from-file -d 'Read pathspec from file'
2354complete -f -c git -n '__fish_git_using_command status' -l pathspec-file-nul -d 'NUL separator for pathspec-from-file'
2355
2356### stripspace
2357complete -f -c git -n __fish_git_needs_command -a stripspace -d 'Remove unnecessary whitespace'
2358complete -f -c git -n '__fish_git_using_command stripspace' -s s -l strip-comments -d 'Strip all lines starting with comment character'
2359complete -f -c git -n '__fish_git_using_command stripspace' -s c -l comment-lines -d 'Prepend comment character to each line'
2360
2361### tag
2362complete -f -c git -n __fish_git_needs_command -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
2363__fish_git_add_revision_completion -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -xpc | string match -r -v \'^-\')) -eq 3'
2364complete -f -c git -n '__fish_git_using_command tag' -s a -l annotate -d 'Make an unsigned, annotated tag object'
2365complete -f -c git -n '__fish_git_using_command tag' -s s -l sign -d 'Make a GPG-signed tag'
2366complete -f -c git -n '__fish_git_using_command tag' -s d -l delete -d 'Remove a tag'
2367complete -f -c git -n '__fish_git_using_command tag' -s v -l verify -d 'Verify signature of a tag'
2368complete -f -c git -n '__fish_git_using_command tag' -s f -l force -d 'Force overwriting existing tag'
2369complete -f -c git -n '__fish_git_using_command tag' -s l -l list -d 'List tags'
2370complete -f -c git -n '__fish_git_using_command tag' -l contains -xka '(__fish_git_commits)' -d 'List tags that contain a commit'
2371complete -f -c git -n '__fish_git_using_command tag' -n '__fish_git_contains_opt -s d delete -s v verify -s f force' -ka '(__fish_git_tags)' -d Tag
2372complete -x -c git -n '__fish_git_using_command tag' -s m -l message -d 'Use the given tag message'
2373complete -F -c git -n '__fish_git_using_command tag' -s F -l file -d 'Read tag message from file'
2374complete -x -c git -n '__fish_git_using_command tag' -s u -l local-user -d 'Use this key to sign tag'
2375complete -x -c git -n '__fish_git_using_command tag' -l cleanup -a 'strip whitespace verbatim' -d 'How to clean up the tag message'
2376complete -f -c git -n '__fish_git_using_command tag' -l create-reflog -d 'Create reflog for the tag'
2377complete -f -c git -n '__fish_git_using_command tag' -l no-create-reflog -d 'Do not create reflog for the tag'
2378complete -x -c git -n '__fish_git_using_command tag' -l color -a 'always never auto' -d 'Respect any colors in format'
2379complete -f -c git -n '__fish_git_using_command tag' -l column -d 'Display tag listing in columns'
2380complete -f -c git -n '__fish_git_using_command tag' -l no-column -d 'Do not display tag listing in columns'
2381complete -x -c git -n '__fish_git_using_command tag' -l sort -d 'Sort tags based on the given key'
2382complete -f -c git -n '__fish_git_using_command tag' -l merged -d 'List tags whose commits are reachable from specified commit'
2383complete -f -c git -n '__fish_git_using_command tag' -l no-merged -d 'List tags whose commits are not reachable from specified commit'
2384complete -x -c git -n '__fish_git_using_command tag' -l points-at -d 'List tags of the given object'
2385
2386### update-index
2387complete -c git -n __fish_git_needs_command -a update-index -d 'Register file contents in the working tree to the index'
2388complete -f -c git -n '__fish_git_using_command update-index' -l add -d 'Add specified files to the index'
2389complete -f -c git -n '__fish_git_using_command update-index' -l remove -d 'Remove specified files from the index'
2390complete -f -c git -n '__fish_git_using_command update-index' -l refresh -d 'Refresh current index'
2391complete -f -c git -n '__fish_git_using_command update-index' -s q -d 'Continue refresh after error'
2392complete -f -c git -n '__fish_git_using_command update-index' -l ignore-submodules -d 'Do not try to update submodules'
2393complete -f -c git -n '__fish_git_using_command update-index' -l unmerged -d 'Continue on unmerged changes in the index'
2394complete -f -c git -n '__fish_git_using_command update-index' -l ignore-missing -d 'Ignores missing files during a refresh'
2395complete -f -c git -n '__fish_git_using_command update-index' -l index-info -d 'Read index information from stdin'
2396complete -x -c git -n '__fish_git_using_command update-index' -l chmod -a '+x\tAdd\ execute\ permissions -x\tRemove\ execute\ permissions' -d 'Set execute permissions'
2397complete -f -c git -n '__fish_git_using_command update-index' -l assume-unchanged -d 'Set the "assume unchanged" bit for the paths'
2398complete -f -c git -n '__fish_git_using_command update-index' -l no-assume-unchanged -d 'Unset the "assume unchanged" bit'
2399complete -f -c git -n '__fish_git_using_command update-index' -l really-refresh -d 'Refresh but check stat info unconditionally'
2400complete -f -c git -n '__fish_git_using_command update-index' -l skip-worktree -d 'Set the "fsmonitor valid" bit'
2401complete -f -c git -n '__fish_git_using_command update-index' -l no-skip-worktree -d 'Unset the "fsmonitor valid" bit'
2402complete -f -c git -n '__fish_git_using_command update-index' -l fsmonitor-valid -d 'Set the "fsmonitor valid" bit'
2403complete -f -c git -n '__fish_git_using_command update-index' -l no-fsmonitor-valid -d 'Unset the "fsmonitor valid" bit'
2404complete -f -c git -n '__fish_git_using_command update-index' -s g -l again -d 'Run git update-index on paths with differing index'
2405complete -f -c git -n '__fish_git_using_command update-index' -l unresolve -d 'Restores the state of a file during a merge'
2406complete -r -c git -n '__fish_git_using_command update-index' -l info-only -d 'Do not create objects in the object database'
2407complete -f -c git -n '__fish_git_using_command update-index' -l force-remove -d 'Forcefully remove the file from the index'
2408complete -f -c git -n '__fish_git_using_command update-index' -l replace -d 'Replace conflicting entries'
2409complete -f -c git -n '__fish_git_using_command update-index' -l stdin -d 'Read list of paths from stdin'
2410complete -f -c git -n '__fish_git_using_command update-index' -l verbose -d 'Report changes to index'
2411complete -x -c git -n '__fish_git_using_command update-index' -l index-version -a "2\t\t3\t\t4" -d 'Set index-version'
2412complete -f -c git -n '__fish_git_using_command update-index' -s z -d 'Separate paths with NUL instead of LF'
2413complete -f -c git -n '__fish_git_using_command update-index' -l split-index -d 'Enable split index mode'
2414complete -f -c git -n '__fish_git_using_command update-index' -l no-split-index -d 'Disable split index mode'
2415complete -f -c git -n '__fish_git_using_command update-index' -l untracked-cache -d 'Enable untracked cache feature'
2416complete -f -c git -n '__fish_git_using_command update-index' -l no-untracked-cache -d 'Disable untracked cache feature'
2417complete -f -c git -n '__fish_git_using_command update-index' -l test-untracked-cache -d 'Only perform tests on the working directory'
2418complete -f -c git -n '__fish_git_using_command update-index' -l force-untracked-cache -d 'Same as --untracked-cache'
2419complete -f -c git -n '__fish_git_using_command update-index' -l fsmonitor -d 'Enable files system monitor feature'
2420complete -f -c git -n '__fish_git_using_command update-index' -l no-fsmonitor -d 'Disable files system monitor feature'
2421
2422### worktree
2423set -l git_worktree_commands add list lock move prune remove unlock
2424complete -c git -n __fish_git_needs_command -a worktree -d 'Manage multiple working trees'
2425complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a add -d 'Create a working tree'
2426complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a list -d 'List details of each worktree'
2427complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a lock -d 'Lock a working tree'
2428complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a move -d 'Move a working tree to a new location'
2429complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a prune -d 'Prune working tree information in $GIT_DIR/worktrees'
2430complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a remove -d 'Remove a working tree'
2431complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a unlock -d 'Unlock a working tree'
2432
2433complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add move remove' -s f -l force -d 'Override safeguards'
2434
2435complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
2436begin
2437    set -lx __fish_git_unqualified_unique_remote_branches true
2438    __fish_git_add_revision_completion -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
2439end
2440complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s b -d 'Create a new branch'
2441complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s B -d 'Create a new branch even if it already exists'
2442complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l detach -d 'Detach HEAD in the new working tree'
2443complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l checkout -d 'Checkout <commit-ish> after creating working tree'
2444complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-checkout -d 'Suppress checkout'
2445complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l guess-remote
2446complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-guess-remote
2447complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l track -d 'Mark <commit-ish> as "upstream" from the new branch'
2448complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-track -d 'Don\'t mark <commit-ish> as "upstream" from the new branch'
2449complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l lock -d 'Lock working tree after creation'
2450complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s q -l quiet -d 'Suppress feedback messages'
2451complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from list' -l porcelain -d 'Output in an easy-to-parse format for scripts'
2452complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from lock' -a '(__fish_git_complete_worktrees)' -d Worktree
2453complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from lock' -l reason -d 'An explanation why the working tree is locked'
2454complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from move' -n 'not __fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_git_complete_worktrees)' -d Worktree
2455complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from move' -n '__fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_complete_directories)'
2456complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -s n -l dry-run -d 'Do not remove anything'
2457complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -s v -l verbose -d 'Report all removals'
2458complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -l expire -d 'Only expire unused working trees older than <time>'
2459complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from remove' -a '(__fish_git_complete_worktrees)' -d Worktree
2460complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from unlock' -a '(__fish_git_complete_worktrees)' -d Worktree
2461
2462### stash
2463complete -c git -n __fish_git_needs_command -a stash -d 'Stash away changes'
2464complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a list -d 'List stashes'
2465complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a show -d 'Show the changes recorded in the stash'
2466complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a pop -d 'Apply and remove a single stashed state'
2467complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a apply -d 'Apply a single stashed state'
2468complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a clear -d 'Remove all stashed states'
2469complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a drop -d 'Remove a single stashed state from the stash list'
2470complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a create -d 'Create a stash'
2471complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a save -d 'Save a new stash'
2472complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a branch -d 'Create a new branch from a stash'
2473complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a push -d 'Create a new stash with given files'
2474
2475complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -a '(__fish_git_files modified deleted modified-staged-deleted)'
2476complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s a -l all -d 'Stash ignored and untracked files'
2477complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s k -l keep-index -d 'Keep changes in index intact'
2478complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s p -l patch -d 'Interactively select hunks'
2479complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s m -l message -d 'Add a description'
2480complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -l no-keep-index -d 'Don\'t keep changes in index intact'
2481complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s S -l staged -d 'Stash only staged changes'
2482complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_is_push -s u -l include-untracked -d 'Stash untracked files'
2483
2484complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply branch drop pop show' -ka '(__fish_git_complete_stashes)'
2485
2486### config
2487complete -f -c git -n __fish_git_needs_command -a config -d 'Set and read git configuration variables'
2488complete -f -c git -n '__fish_git_using_command config' -l local -d 'Write to repository .git/config'
2489complete -f -c git -n '__fish_git_using_command config' -l global -d 'Write to global ~/.gitconfig'
2490complete -f -c git -n '__fish_git_using_command config' -l system -d 'Write to system-wide /etc/gitconfig'
2491complete -f -c git -n '__fish_git_using_command config' -l worktree -d 'Write to .git/config.worktree'
2492complete -F -c git -n '__fish_git_using_command config' -s f -l file -d 'Use given config file'
2493complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config from given blob object'
2494complete -f -c git -n '__fish_git_using_command config' -s l -l list -d 'List all variables set in config'
2495complete -f -c git -n '__fish_git_using_command config' -s e -l edit -d 'Open config file in editor'
2496complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get value for given key'
2497complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values for a multi-valued key'
2498complete -f -c git -n '__fish_git_using_command config' -l get-regexp -d 'Get values for keys matching regex'
2499complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value for URL-specific key'
2500complete -f -c git -n '__fish_git_using_command config' -l add -d 'Add new line without altering existing values'
2501complete -f -c git -n '__fish_git_using_command config' -l unset -d 'Remove line matching key'
2502complete -f -c git -n '__fish_git_using_command config' -l unset-all -d 'Remove all lines matching key'
2503complete -f -c git -n '__fish_git_using_command config' -l replace-all -d 'Replace all matching lines'
2504complete -f -c git -n '__fish_git_using_command config' -l rename-section -d 'Rename given section'
2505complete -f -c git -n '__fish_git_using_command config' -l remove-section -d 'Remove given section'
2506complete -x -c git -n '__fish_git_using_command config' -l type -a 'bool int bool-or-int path expiry-date color' -d 'Ensure value is of given type'
2507complete -f -c git -n '__fish_git_using_command config' -l bool -d 'Value is true or false'
2508complete -f -c git -n '__fish_git_using_command config' -l int -d 'Value is a decimal number'
2509complete -f -c git -n '__fish_git_using_command config' -l bool-or-int -d 'Value is bool or int'
2510complete -f -c git -n '__fish_git_using_command config' -l path -d 'Value is a path'
2511complete -f -c git -n '__fish_git_using_command config' -s z -l null -d 'Terminate values with NUL byte'
2512complete -f -c git -n '__fish_git_using_command config' -l name-only -d 'Output only names of config variables'
2513complete -f -c git -n '__fish_git_using_command config' -l show-origin -d 'Show origin of config'
2514complete -f -c git -n '__fish_git_using_command config' -l show-scope -d 'Show scope of config'
2515complete -f -c git -n '__fish_git_using_command config' -l includes -d 'Respect include directives'
2516complete -f -c git -n '__fish_git_using_command config' -l no-includes -d 'Do not respect include directives'
2517complete -x -c git -n '__fish_git_using_command config' -l default -d 'Use default value when variable is missing'
2518complete -f -c git -n '__fish_git_using_command config' -a '(__fish_git_config_keys)' -d 'Config key'
2519
2520### format-patch
2521complete -f -c git -n __fish_git_needs_command -a format-patch -d 'Generate patch series to send upstream'
2522__fish_git_add_revision_completion -n '__fish_git_using_command format-patch'
2523complete -c git -n '__fish_git_using_command format-patch' -s o -l output-directory -xa '(__fish_complete_directories)'
2524complete -f -c git -n '__fish_git_using_command format-patch' -s p -l no-stat -d "Generate plain patches without diffstat"
2525complete -f -c git -n '__fish_git_using_command format-patch' -s s -l no-patch -d "Suppress diff output"
2526complete -f -c git -n '__fish_git_using_command format-patch' -l minimal -d "Spend more time to create smaller diffs"
2527complete -f -c git -n '__fish_git_using_command format-patch' -l patience -d "Generate diff with the 'patience' algorithm"
2528complete -f -c git -n '__fish_git_using_command format-patch' -l histogram -d "Generate diff with the 'histogram' algorithm"
2529complete -f -c git -n '__fish_git_using_command format-patch' -l stdout -d "Print all commits to stdout in mbox format"
2530complete -f -c git -n '__fish_git_using_command format-patch' -l numstat -d "Show number of added/deleted lines in decimal notation"
2531complete -f -c git -n '__fish_git_using_command format-patch' -l shortstat -d "Output only last line of the stat"
2532complete -f -c git -n '__fish_git_using_command format-patch' -l summary -d "Output a condensed summary of extended header information"
2533complete -f -c git -n '__fish_git_using_command format-patch' -l no-renames -d "Disable rename detection"
2534complete -f -c git -n '__fish_git_using_command format-patch' -l full-index -d "Show full blob object names"
2535complete -f -c git -n '__fish_git_using_command format-patch' -l binary -d "Output a binary diff for use with git apply"
2536complete -f -c git -n '__fish_git_using_command format-patch log' -l find-copies-harder -d "Also inspect unmodified files as source for a copy"
2537complete -f -c git -n '__fish_git_using_command format-patch' -l text -s a -d "Treat all files as text"
2538complete -f -c git -n '__fish_git_using_command format-patch log' -l ignore-space-at-eol -d "Ignore changes in whitespace at EOL"
2539complete -f -c git -n '__fish_git_using_command format-patch log' -l ignore-space-change -s b -d "Ignore changes in amount of whitespace"
2540complete -f -c git -n '__fish_git_using_command format-patch log' -l ignore-all-space -s w -d "Ignore whitespace when comparing lines"
2541complete -f -c git -n '__fish_git_using_command format-patch log' -l ignore-blank-lines -d "Ignore changes whose lines are all blank"
2542complete -f -c git -n '__fish_git_using_command format-patch log' -l function-context -s W -d "Show whole surrounding functions of changes"
2543complete -f -c git -n '__fish_git_using_command format-patch log' -l ext-diff -d "Allow an external diff helper to be executed"
2544complete -f -c git -n '__fish_git_using_command format-patch log' -l no-ext-diff -d "Disallow external diff helpers"
2545complete -f -c git -n '__fish_git_using_command format-patch log' -l no-textconv -d "Disallow external text conversion filters for binary files (Default)"
2546complete -f -c git -n '__fish_git_using_command format-patch log' -l textconv -d "Allow external filters for binary files (Resulting diff is unappliable)"
2547complete -f -c git -n '__fish_git_using_command format-patch log' -l no-prefix -d "Do not show source or destination prefix"
2548complete -f -c git -n '__fish_git_using_command format-patch' -l numbered -s n -d "Name output in [Patch n/m] format, even with a single patch"
2549complete -f -c git -n '__fish_git_using_command format-patch' -l no-numbered -s N -d "Name output in [Patch] format, even with multiple patches"
2550
2551## git submodule
2552set -l submodulecommands add status init deinit update set-branch set-url summary foreach sync absorbgitdirs
2553complete -f -c git -n __fish_git_needs_command -a submodule -d 'Initialize, update or inspect submodules'
2554complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a add -d 'Add a submodule'
2555complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a status -d 'Show submodule status'
2556complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a init -d 'Initialize all submodules'
2557complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a deinit -d 'Unregister the given submodules'
2558complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a update -d 'Update all submodules'
2559complete -x -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a set-branch -d 'Set the default remote tracking branch'
2560complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a set-url -d 'Sets the URL of the specified submodule'
2561complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a summary -d 'Show commit summary'
2562complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a foreach -d 'Run command on each submodule'
2563complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a sync -d 'Sync submodules\' URL with .gitmodules'
2564complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a absorbgitdirs -d 'Move submodule\'s git directory to current .git/module directory'
2565complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -s q -l quiet -d "Only print error messages"
2566complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l init -d "Initialize all submodules"
2567complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l checkout -d "Checkout the superproject's commit on a detached HEAD in the submodule"
2568complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l merge -d "Merge the superproject's commit into the current branch of the submodule"
2569complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l rebase -d "Rebase current branch onto the superproject's commit"
2570complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -s N -l no-fetch -d "Don't fetch new objects from the remote"
2571complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l remote -d "Instead of using superproject's SHA-1, use the state of the submodule's remote-tracking branch"
2572complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l force -d "Discard local changes when switching to a different commit & always run checkout"
2573complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l filter -ra '(__fish_git_filters)' -d 'Request a subset of objects from server'
2574complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from add' -l force -d "Also add ignored submodule path"
2575complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -l force -d "Remove even with local changes"
2576complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -l all -d "Remove all submodules"
2577complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_submodules)' -d Submodule
2578complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from set-branch' -s b -l branch -d "Specify the branch to use"
2579complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from set-branch' -s d -l default -d "Use default branch of the submodule"
2580complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from status summary' -l cached -d "Use the commit stored in the index"
2581complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from status' -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_submodules)' -d Submodule
2582complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from summary' -l files -d "Compare the commit in the index with submodule HEAD"
2583complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from foreach update status' -l recursive -d "Traverse submodules recursively"
2584complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from foreach' -a "(__fish_complete_subcommand --fcs-skip=3)"
2585
2586## git whatchanged
2587complete -f -c git -n __fish_git_needs_command -a whatchanged -d 'Show logs with difference each commit introduces'
2588
2589## Aliases (custom user-defined commands)
2590complete -c git -n __fish_git_needs_command -a '(__fish_git_aliases)'
2591
2592### git clean
2593complete -f -c git -n __fish_git_needs_command -a clean -d 'Remove untracked files from the working tree'
2594complete -f -c git -n '__fish_git_using_command clean' -s f -l force -d 'Force run'
2595complete -f -c git -n '__fish_git_using_command clean' -s i -l interactive -d 'Show what would be done and clean files interactively'
2596complete -f -c git -n '__fish_git_using_command clean' -s n -l dry-run -d 'Don\'t actually remove anything, just show what would be done'
2597complete -f -c git -n '__fish_git_using_command clean' -s q -l quiet -d 'Be quiet, only report errors'
2598complete -f -c git -n '__fish_git_using_command clean' -s d -d 'Remove untracked directories in addition to untracked files'
2599complete -f -c git -n '__fish_git_using_command clean' -s x -d 'Remove ignored files, as well'
2600complete -f -c git -n '__fish_git_using_command clean' -s X -d 'Remove only ignored files'
2601complete -x -c git -n '__fish_git_using_command clean' -s e -l exclude -d 'Add pattern to exclude from removal'
2602
2603### git blame
2604complete -f -c git -n __fish_git_needs_command -a blame -d 'Show what last modified each line of a file'
2605complete -f -c git -n '__fish_git_using_command blame' -s b -d 'Show blank SHA-1 for boundary commits'
2606complete -f -c git -n '__fish_git_using_command blame' -l root -d 'Do not treat root commits as boundaries'
2607complete -f -c git -n '__fish_git_using_command blame' -l show-stats -d 'Include additional statistics'
2608complete -f -c git -n '__fish_git_using_command blame' -s L -d 'Annotate only the given line range'
2609complete -f -c git -n '__fish_git_using_command blame' -s l -d 'Show long rev'
2610complete -f -c git -n '__fish_git_using_command blame' -s t -d 'Show raw timestamp'
2611complete -r -c git -n '__fish_git_using_command blame' -s S -d 'Use revisions from named file instead of calling rev-list'
2612complete -f -c git -n '__fish_git_using_command blame' -l reverse -d 'Walk history forward instead of backward'
2613complete -f -c git -n '__fish_git_using_command blame' -s p -l porcelain -d 'Show in a format designed for machine consumption'
2614complete -f -c git -n '__fish_git_using_command blame' -l line-porcelain -d 'Show the porcelain format'
2615complete -f -c git -n '__fish_git_using_command blame' -l incremental -d 'Show the result incrementally'
2616complete -r -c git -n '__fish_git_using_command blame' -l contents -d 'Instead of working tree, use the contents of the named file'
2617complete -x -c git -n '__fish_git_using_command blame' -l date -d 'Specifies the format used to output dates'
2618complete -f -c git -n '__fish_git_using_command blame' -s M -d 'Detect moved or copied lines within a file'
2619complete -f -c git -n '__fish_git_using_command blame' -s C -d 'Detect lines moved or copied from other files modified in the same commit'
2620complete -f -c git -n '__fish_git_using_command blame' -s h -d 'Show help message'
2621complete -f -c git -n '__fish_git_using_command blame' -s c -d 'Use the same output mode as git-annotate'
2622complete -f -c git -n '__fish_git_using_command blame' -s f -l show-name -d 'Show the filename in the original commit'
2623complete -f -c git -n '__fish_git_using_command blame' -s n -l show-number -d 'Show the line number in the original commit'
2624complete -f -c git -n '__fish_git_using_command blame' -s s -d 'Suppress the author name and timestamp from the output'
2625complete -f -c git -n '__fish_git_using_command blame' -s e -l show-email -d 'Show the author email instead of author name'
2626complete -f -c git -n '__fish_git_using_command blame' -s w -d 'Ignore whitespace changes'
2627
2628### help
2629complete -f -c git -n __fish_git_needs_command -a help -d 'Display help information about Git'
2630complete -f -c git -n '__fish_git_using_command help' -a '(__fish_git_help_all_concepts)'
2631complete -f -c git -n '__fish_git_using_command help' -a add -d 'Add file contents to the index'
2632complete -f -c git -n '__fish_git_using_command help' -a am -d 'Apply a series of patches from a mailbox'
2633complete -f -c git -n '__fish_git_using_command help' -a apply -d 'Apply a patch on a git index file and a working tree'
2634complete -f -c git -n '__fish_git_using_command help' -a archive -d 'Create an archive of files from a named tree'
2635complete -f -c git -n '__fish_git_using_command help' -a bisect -d 'Find the change that introduced a bug by binary search'
2636complete -f -c git -n '__fish_git_using_command help' -a blame -d 'Show what revision and author last modified each line of a file'
2637complete -f -c git -n '__fish_git_using_command help' -a branch -d 'List, create, or delete branches'
2638complete -f -c git -n '__fish_git_using_command help' -a checkout -d 'Checkout and switch to a branch'
2639complete -f -c git -n '__fish_git_using_command help' -a cherry-pick -d 'Apply the change introduced by an existing commit'
2640complete -f -c git -n '__fish_git_using_command help' -a clean -d 'Remove untracked files from the working tree'
2641complete -f -c git -n '__fish_git_using_command help' -a clone -d 'Clone a repository into a new directory'
2642complete -f -c git -n '__fish_git_using_command help' -a commit -d 'Record changes to the repository'
2643complete -f -c git -n '__fish_git_using_command help' -a config -d 'Set and read git configuration variables'
2644complete -f -c git -n '__fish_git_using_command help' -a count-objects -d 'Count unpacked number of objects and their disk consumption'
2645complete -f -c git -n '__fish_git_using_command help' -a describe -d 'Give an object a human-readable name'
2646complete -f -c git -n '__fish_git_using_command help' -a diff -d 'Show changes between commits, commit and working tree, etc'
2647complete -f -c git -n '__fish_git_using_command help' -a daemon -d 'A really simple server for Git repositories'
2648complete -f -c git -n '__fish_git_using_command help' -a difftool -d 'Open diffs in a visual tool'
2649complete -f -c git -n '__fish_git_using_command help' -a fetch -d 'Download objects and refs from another repository'
2650complete -f -c git -n '__fish_git_using_command help' -a filter-branch -d 'Rewrite branches'
2651complete -f -c git -n '__fish_git_using_command help' -a format-patch -d 'Generate patch series to send upstream'
2652complete -f -c git -n '__fish_git_using_command help' -a gc -d 'Cleanup unnecessary files and optimize the local repository'
2653complete -f -c git -n '__fish_git_using_command help' -a grep -d 'Print lines matching a pattern'
2654complete -f -c git -n '__fish_git_using_command help' -a init -d 'Create an empty git repository or reinitialize an existing one'
2655complete -f -c git -n '__fish_git_using_command help' -a log -d 'Show commit logs'
2656complete -f -c git -n '__fish_git_using_command help' -a ls-files -d 'Show information about files in the index and the working tree'
2657complete -f -c git -n '__fish_git_using_command help' -a mailinfo -d 'Extracts patch and authorship from a single e-mail message'
2658complete -f -c git -n '__fish_git_using_command help' -a mailsplit -d 'Simple UNIX mbox splitter program'
2659complete -f -c git -n '__fish_git_using_command help' -a maintenance -d 'Run tasks to optimize Git repository data'
2660complete -f -c git -n '__fish_git_using_command help' -a merge -d 'Join two or more development histories together'
2661complete -f -c git -n '__fish_git_using_command help' -a merge-base -d 'Find as good common ancestors as possible for a merge'
2662complete -f -c git -n '__fish_git_using_command help' -a mergetool -d 'Run merge conflict resolution tools to resolve merge conflicts'
2663complete -f -c git -n '__fish_git_using_command help' -a mv -d 'Move or rename a file, a directory, or a symlink'
2664complete -f -c git -n '__fish_git_using_command help' -a notes -d 'Add or inspect object notes'
2665complete -f -c git -n '__fish_git_using_command help' -a prune -d 'Prune all unreachable objects from the object database'
2666complete -f -c git -n '__fish_git_using_command help' -a pull -d 'Fetch from and merge with another repository or a local branch'
2667complete -f -c git -n '__fish_git_using_command help' -a push -d 'Update remote refs along with associated objects'
2668complete -f -c git -n '__fish_git_using_command help' -a range-diff -d 'Compare two commit ranges (e.g. two versions of a branch)'
2669complete -f -c git -n '__fish_git_using_command help' -a rebase -d 'Forward-port local commits to the updated upstream head'
2670complete -f -c git -n '__fish_git_using_command help' -a reflog -d 'Manage reflog information'
2671complete -f -c git -n '__fish_git_using_command help' -a remote -d 'Manage set of tracked repositories'
2672complete -f -c git -n '__fish_git_using_command help' -a reset -d 'Reset current HEAD to the specified state'
2673complete -f -c git -n '__fish_git_using_command help' -a restore -d 'Restore working tree files'
2674complete -f -c git -n '__fish_git_using_command help' -a revert -d 'Revert an existing commit'
2675complete -f -c git -n '__fish_git_using_command help' -a rev-parse -d 'Pick out and massage parameters'
2676complete -f -c git -n '__fish_git_using_command help' -a rm -d 'Remove files from the working tree and from the index'
2677complete -f -c git -n '__fish_git_using_command help' -a show -d 'Shows the last commit of a branch'
2678complete -f -c git -n '__fish_git_using_command help' -a show-branch -d 'Shows the commits on branches'
2679complete -f -c git -n '__fish_git_using_command help' -a stash -d 'Stash away changes'
2680complete -f -c git -n '__fish_git_using_command help' -a status -d 'Show the working tree status'
2681complete -f -c git -n '__fish_git_using_command help' -a submodule -d 'Initialize, update or inspect submodules'
2682complete -f -c git -n '__fish_git_using_command help' -a stripspace -d 'Remove unnecessary whitespace'
2683complete -f -c git -n '__fish_git_using_command help' -a switch -d 'Switch to a branch'
2684complete -f -c git -n '__fish_git_using_command help' -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
2685complete -f -c git -n '__fish_git_using_command help' -a update-index -d 'Register file contents in the working tree to the index'
2686complete -f -c git -n '__fish_git_using_command help' -a whatchanged -d 'Show logs with difference each commit introduces'
2687complete -f -c git -n '__fish_git_using_command help' -a worktree -d 'Manage multiple working trees'
2688
2689# Complete both options and possible parameters to `git config`
2690complete -f -c git -n '__fish_git_using_command config' -l global -d 'Get/set global configuration'
2691complete -f -c git -n '__fish_git_using_command config' -l system -d 'Get/set system configuration'
2692complete -f -c git -n '__fish_git_using_command config' -l local -d 'Get/set local repo configuration'
2693complete -F -c git -n '__fish_git_using_command config' -s f -l file -d 'Read config from file' -r
2694complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config from blob' -r
2695
2696# For config options that have the user select one from a set, this function completes possible options
2697function __fish_git_complete_key_values
2698    set -l config_key (__fish_nth_token 2)
2699
2700    switch $config_key
2701        case diff.algorithm
2702            printf "%s\n" myers patience histogram minimal
2703        case init.defaultBranch
2704            printf "%s\n" master main trunk dev next
2705        case '*'
2706            __fish_complete_path
2707    end
2708end
2709
2710# If no argument is specified, it's as if --get was used
2711# Use -k with `__fish_git_config_keys` so that user defined values are shown first
2712complete -c git -n '__fish_git_using_command config' -n '__fish_is_nth_token 2' -kfa '(__fish_git_config_keys)'
2713complete -c git -n '__fish_git_using_command config' -n '__fish_is_nth_token 3' -fa '(__fish_git_complete_key_values)'
2714complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)'
2715complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values matching key' -ka '(__fish_git_config_keys)'
2716complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value specific for the section url' -r
2717complete -f -c git -n '__fish_git_using_command config' -l replace-all -d 'Replace all matching variables' -kra '(__fish_git_config_keys)'
2718complete -f -c git -n '__fish_git_using_command config' -l add -d 'Add a new variable' -r
2719complete -f -c git -n '__fish_git_using_command config' -l unset -d 'Remove a variable' -ka '(__fish_git_config_keys)'
2720complete -f -c git -n '__fish_git_using_command config' -l unset-all -d 'Remove matching variables' -ka '(__fish_git_config_keys)'
2721complete -f -c git -n '__fish_git_using_command config' -l rename-section -d 'Rename section' -r
2722complete -f -c git -n '__fish_git_using_command config' -s l -l list -d 'List all variables'
2723complete -f -c git -n '__fish_git_using_command config' -s e -l edit -d 'Open configuration in an editor'
2724
2725complete -f -c git -n '__fish_git_using_command config' -s t -l type -d 'Value is of given type'
2726complete -f -c git -n '__fish_git_using_command config' -l bool -d 'Value is \'true\' or \'false\''
2727complete -f -c git -n '__fish_git_using_command config' -l int -d 'Value is a decimal number'
2728complete -f -c git -n '__fish_git_using_command config' -l bool-or-int -d 'Value is --bool or --int'
2729complete -f -c git -n '__fish_git_using_command config' -l path -d 'Value is a path'
2730complete -f -c git -n '__fish_git_using_command config' -l expiry-date -d 'Value is an expiry date'
2731
2732complete -f -c git -n '__fish_git_using_command config' -s z -l null -d 'Terminate values with NUL byte'
2733complete -f -c git -n '__fish_git_using_command config' -l name-only -d 'Show variable names only'
2734complete -f -c git -n '__fish_git_using_command config' -l includes -d 'Respect include directives'
2735complete -f -c git -n '__fish_git_using_command config' -l show-origin -d 'Show origin of configuration'
2736complete -f -c git -n '__fish_git_using_command config' -n '__fish_seen_argument get' -l default -d 'Use default value when missing entry'
2737
2738### for-each-ref
2739complete -f -c git -n __fish_git_needs_command -a for-each-ref -d "Format and output info on each ref"
2740complete -f -c git -n '__fish_git_using_command for-each-ref' -l count -d "Limit to n results"
2741# Any one of --shell, --perl, --python, or --tcl
2742set -l for_each_ref_interpreters shell perl python tcl
2743for intr in $for_each_ref_interpreters
2744    complete -f -c git -n '__fish_git_using_command for-each-ref' \
2745        -n "not __fish_seen_argument --$for_each_ref_interpreters" \
2746        -l $intr -d "%(fieldname) placeholders are $intr scripts"
2747end
2748complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l format -d "Format string with %(fieldname) placeholders"
2749complete -f -c git -n '__fish_git_using_command for-each-ref' -f -l color -d "When to color" -a "always never auto"
2750complete -f -c git -n '__fish_git_using_command for-each-ref' -l points-at -d "Only list refs pointing at object" -ka '(__fish_git_commits)'
2751complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l merged -d "Only list refs reachable from specified commit" -ka '(__fish_git_commits)'
2752complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l no-merged -d "Only list refs not reachable from specified commit" -ka '(__fish_git_commits)'
2753complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l contains -d "Only list refs containing the specified commit" -ka '(__fish_git_commits)'
2754complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l no-contains -d "Only list refs not containing the specified commit" -ka '(__fish_git_commits)'
2755complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l ignore-case -d "Sorting and filtering refs are case insensitive"
2756
2757### send-email
2758complete -f -c git -n __fish_git_needs_command -a send-email -d 'Send a collection of patches as emails'
2759complete -f -c git -n '__fish_git_using_command send-email' -l annotate -d 'Edit patches before sending'
2760complete -f -c git -n '__fish_git_using_command send-email' -l bcc -r -d 'Specify Bcc: value'
2761complete -f -c git -n '__fish_git_using_command send-email' -l cc -r -d 'Specify Cc: value'
2762complete -f -c git -n '__fish_git_using_command send-email' -l compose -d 'Add an introductory message'
2763complete -f -c git -n '__fish_git_using_command send-email' -l from -r -d Sender
2764complete -f -c git -n '__fish_git_using_command send-email' -l reply-to -r -d 'Address for replies'
2765complete -f -c git -n '__fish_git_using_command send-email' -l in-reply-to -r -d 'Reply in thread to given Message-ID'
2766complete -f -c git -n '__fish_git_using_command send-email' -l subject -r -d Subject
2767complete -f -c git -n '__fish_git_using_command send-email' -l to -r -d Recipient
2768complete -f -c git -n '__fish_git_using_command send-email' -l 8bit-encoding -ra UTF-8 -d 'Encoding for non-ASCII messages'
2769complete -f -c git -n '__fish_git_using_command send-email' -l compose-encoding -ra UTF-8 -d 'Encoding for the compose message'
2770complete -f -c git -n '__fish_git_using_command send-email' -l transfer-encoding -ra '7bit 8bit quoted-printable base64 auto' -d 'Encoding for transferring over SMTP'
2771complete -f -c git -n '__fish_git_using_command send-email' -l xmailer -d 'Add X-Mailer: header'
2772complete -f -c git -n '__fish_git_using_command send-email' -l no-xmailer -d 'Suppress X-Mailer: header'
2773complete -f -c git -n '__fish_git_using_command send-email' -l envelope-sender -r
2774complete -f -c git -n '__fish_git_using_command send-email' -l sendmail-cmd -ra '(__fish_complete_command)' -d 'Command to send email'
2775complete -f -c git -n '__fish_git_using_command send-email' -l smtp-encryption -ra 'ssl tls'
2776complete -f -c git -n '__fish_git_using_command send-email' -l smtp-domain -r
2777complete -f -c git -n '__fish_git_using_command send-email' -l smtp-auth -r -d 'Restrict auth mechanisms'
2778complete -f -c git -n '__fish_git_using_command send-email' -l smtp-pass -r
2779complete -f -c git -n '__fish_git_using_command send-email' -l no-smtp-auth
2780complete -f -c git -n '__fish_git_using_command send-email' -l smtp-server -r
2781complete -f -c git -n '__fish_git_using_command send-email' -l smtp-server-port -r
2782complete -f -c git -n '__fish_git_using_command send-email' -l smtp-server-option -r
2783complete -c git -n '__fish_git_using_command send-email' -l smtp-ssl-cert-path -r
2784complete -f -c git -n '__fish_git_using_command send-email' -l smtp-user -r
2785complete -f -c git -n '__fish_git_using_command send-email' -l smt-debug -ra '0 1' -d 'SMTP debug output'
2786complete -f -c git -n '__fish_git_using_command send-email' -l batch-size -r -d 'Reconnect after sending this many messages'
2787complete -f -c git -n '__fish_git_using_command send-email' -l relogin-dleay -r -d 'Seconds to wait before reconnecting'
2788complete -f -c git -n '__fish_git_using_command send-email' -l no-to -d 'Clear To:'
2789complete -f -c git -n '__fish_git_using_command send-email' -l no-cc -d 'Clear Cc:'
2790complete -f -c git -n '__fish_git_using_command send-email' -l no-bcc -d 'Clear Bcc:'
2791complete -f -c git -n '__fish_git_using_command send-email' -l no-identity
2792complete -f -c git -n '__fish_git_using_command send-email' -l to-cmd -ra '(__fish_complete_command)' -d 'Command to generate To: lines'
2793complete -f -c git -n '__fish_git_using_command send-email' -l cc-cmd -ra '(__fish_complete_command)' -d 'Command to generate Cc: lines'
2794complete -f -c git -n '__fish_git_using_command send-email' -l header-cmd -ra '(__fish_complete_command)' -d 'Command to generate header lines'
2795complete -f -c git -n '__fish_git_using_command send-email' -l no-header-cmd -d 'Disable any header command'
2796complete -f -c git -n '__fish_git_using_command send-email' -l chain-reply-to -d 'Each email is sent as reply to the previous one'
2797complete -f -c git -n '__fish_git_using_command send-email' -l no-chain-reply-to -d 'Each email is sent as reply to the first one'
2798complete -f -c git -n '__fish_git_using_command send-email' -l identity -r -d 'Configuration identity'
2799complete -f -c git -n '__fish_git_using_command send-email' -l signed-off-by-cc -d 'Add addresses in Signed-off-by trailers to Cc'
2800complete -f -c git -n '__fish_git_using_command send-email' -l no-signed-off-by-cc -d 'Do not add Signed-off-by trailers to Cc'
2801complete -f -c git -n '__fish_git_using_command send-email' -l cc-cover -d 'Copy Cc: list from first message to the others'
2802complete -f -c git -n '__fish_git_using_command send-email' -l no-cc-cover -d 'Do not copy Cc: list from first message'
2803complete -f -c git -n '__fish_git_using_command send-email' -l to-cover -d 'Copy To: list from first message to the others'
2804complete -f -c git -n '__fish_git_using_command send-email' -l no-to-cover -d 'Do not copy To: list from first message'
2805complete -f -c git -n '__fish_git_using_command send-email' -l suppress-cc -ra '
2806    author\t"Do not auto-cc patch author"
2807    self\t"Do not auto-cc sender"
2808    cc\t"Do not auto-cc address from Cc lines in patch header"
2809    bodycc\t"Do not auto-cc addresses from Cc lines in patch body"
2810    sob\t"Do not auto-cc address from Signed-off-by trailers"
2811    misc-by\t"Do not auto-cc addresses from commit trailers"
2812    cccmd\t"Do not run --cc-cmd"
2813    body\t"equivalent to sob + bodycc + misc-by"
2814    all\t"Do not auto-cc anyone"
2815' -d 'Suppress auto-cc of recipient categories'
2816complete -f -c git -n '__fish_git_using_command send-email' -l suppress-from -d 'Do not cc the From: address'
2817complete -f -c git -n '__fish_git_using_command send-email' -l no-suppress-from -d 'Do cc the From: address'
2818complete -f -c git -n '__fish_git_using_command send-email' -l thread -d 'Create an email thread'
2819complete -f -c git -n '__fish_git_using_command send-email' -l no-thread -d 'Do not create an email thread'
2820complete -f -c git -n '__fish_git_using_command send-email' -l confirm -ra '
2821    always\t"Always confirm before sending"
2822    never\t"Never confirm before sending"
2823    cc\t"Confirm before sending if CC lines have been added"
2824    compose\t"Confirm before sending if using --compose"
2825    auto\t"Equivalent to cc + compose"
2826' -d 'Confirm just before sending'
2827complete -f -c git -n '__fish_git_using_command send-email' -l dry-run -d 'Do everything except actually send the emails'
2828complete -f -c git -n '__fish_git_using_command send-email' -l format-patch -d 'Ambiguous arguments are for format-patch, not filenames'
2829complete -f -c git -n '__fish_git_using_command send-email' -l no-format-patch -d 'Interpret ambiguous arguments as filenames, not format-patch arguments'
2830complete -f -c git -n '__fish_git_using_command send-email' -l quiet -d 'Print only one line per email'
2831complete -f -c git -n '__fish_git_using_command send-email' -l validate -d 'Perform sanity checks'
2832complete -f -c git -n '__fish_git_using_command send-email' -l no-validate -d 'Skip sanity checks'
2833complete -f -c git -n '__fish_git_using_command send-email' -l force -d 'Ignore safety checks'
2834complete -f -c git -n '__fish_git_using_command send-email' -l dump-aliases -d 'Dump shorthand alias names'
2835
2836### subcommands supporting --sort (XXX: list may not be complete!)
2837set -l sortcommands branch for-each-ref tag
2838# A list of keys one could reasonably sort refs by. This isn't the list of all keys that
2839# can be used as any git internal key for a ref may be used here, sorted by binary value.
2840function __fish_git_sort_keys
2841    echo -objectsize\tSize of branch or commit
2842    echo -authordate\tWhen the latest commit was actually made
2843    echo -committerdate\tWhen the branch was last committed or rebased
2844    echo -creatordate\tWhen the latest commit or tag was created
2845    echo creator\tThe name of the commit author
2846    echo objectname\tThe complete SHA1
2847    echo objectname:short\tThe shortest non-ambiguous SHA1
2848    echo refname\tThe complete, unambiguous git ref name
2849    echo refname:short\tThe shortest non-ambiguous ref name
2850    echo author\tThe name of the author of the latest commit
2851    echo committer\tThe name of the person who committed latest
2852    echo tagger\tThe name of the person who created the tag
2853    echo authoremail\tThe email of the author of the latest commit
2854    echo committeremail\tThe email of the person who committed last
2855    echo taggeremail\tThe email of the person who created the tag
2856end
2857complete -f -c git -n "__fish_seen_subcommand_from $sortcommands" -l sort -d 'Sort results by' -a "(__fish_git_sort_keys)"
2858
2859### Plumbing commands
2860
2861### cat-file
2862complete -f -c git -n __fish_git_needs_command -a cat-file -d 'Provide content or type info for repository objects'
2863complete -f -c git -n '__fish_git_using_command cat-file' -s t -d 'Show object type'
2864complete -f -c git -n '__fish_git_using_command cat-file' -s s -d 'Show object size'
2865complete -f -c git -n '__fish_git_using_command cat-file' -s e -d 'Exit with zero if object exists and is valid'
2866complete -f -c git -n '__fish_git_using_command cat-file' -s p -d 'Pretty-print object content'
2867complete -f -c git -n '__fish_git_using_command cat-file' -l textconv -d 'Show content as transformed by a textconv filter'
2868complete -f -c git -n '__fish_git_using_command cat-file' -l filters -d 'Show content as transformed by filters'
2869complete -f -c git -n '__fish_git_using_command cat-file' -l batch -d 'Read objects from stdin and print info'
2870complete -f -c git -n '__fish_git_using_command cat-file' -l batch-check -d 'Read objects from stdin and print type/size info'
2871complete -f -c git -n '__fish_git_using_command cat-file' -l batch-all-objects -d 'Print info for all objects'
2872complete -f -c git -n '__fish_git_using_command cat-file' -l follow-symlinks -d 'Follow symlinks when using --batch'
2873
2874### ls-remote
2875complete -f -c git -n __fish_git_needs_command -a ls-remote -d 'List references in a remote repository'
2876complete -f -c git -n '__fish_git_using_command ls-remote' -s h -l heads -d 'Limit to refs/heads'
2877complete -f -c git -n '__fish_git_using_command ls-remote' -s t -l tags -d 'Limit to refs/tags'
2878complete -f -c git -n '__fish_git_using_command ls-remote' -l refs -d 'Do not show peeled tags or pseudorefs'
2879complete -f -c git -n '__fish_git_using_command ls-remote' -s q -l quiet -d 'Do not print remote URL'
2880complete -x -c git -n '__fish_git_using_command ls-remote' -l upload-pack -d 'Path to git-upload-pack on remote'
2881complete -f -c git -n '__fish_git_using_command ls-remote' -l exit-code -d 'Exit with status 2 if no matching refs are found'
2882complete -f -c git -n '__fish_git_using_command ls-remote' -l get-url -d 'Print URL of remote'
2883complete -f -c git -n '__fish_git_using_command ls-remote' -l symref -d 'Show underlying ref for symbolic refs'
2884complete -x -c git -n '__fish_git_using_command ls-remote' -l sort -d 'Sort based on the given key'
2885complete -f -c git -n '__fish_git_using_command ls-remote' -a '(__fish_git_remotes)' -d Remote
2886
2887### ls-tree
2888complete -f -c git -n __fish_git_needs_command -a ls-tree -d 'List contents of a tree object'
2889complete -f -c git -n '__fish_git_using_command ls-tree' -s d -d 'Only show trees'
2890complete -f -c git -n '__fish_git_using_command ls-tree' -s r -d 'Recurse into subtrees'
2891complete -f -c git -n '__fish_git_using_command ls-tree' -s t -d 'Show tree entries even when recursing'
2892complete -f -c git -n '__fish_git_using_command ls-tree' -l name-only -d 'Show only names'
2893complete -f -c git -n '__fish_git_using_command ls-tree' -l name-status -d 'Show only names (same as name-only)'
2894complete -f -c git -n '__fish_git_using_command ls-tree' -l full-name -d 'Show full path names'
2895complete -f -c git -n '__fish_git_using_command ls-tree' -l full-tree -d 'Do not limit listing to current directory'
2896complete -f -c git -n '__fish_git_using_command ls-tree' -s z -d 'NUL line termination on output'
2897complete -f -c git -n '__fish_git_using_command ls-tree' -l long -d 'Show object size'
2898complete -f -c git -n '__fish_git_using_command ls-tree' -l abbrev -d 'Show abbreviated object names'
2899complete -f -c git -n '__fish_git_using_command ls-tree' -a '(__fish_git_refs)' -d Ref
2900
2901### show-ref
2902complete -f -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a show-ref -d 'List references in a local repository'
2903complete -f -c git -n '__fish_git_using_command show-ref' -l head -d 'Show HEAD reference'
2904complete -f -c git -n '__fish_git_using_command show-ref' -l heads -d 'Limit to refs/heads'
2905complete -f -c git -n '__fish_git_using_command show-ref' -l tags -d 'Limit to refs/tags'
2906complete -f -c git -n '__fish_git_using_command show-ref' -s d -l dereference -d 'Dereference tags'
2907complete -f -c git -n '__fish_git_using_command show-ref' -s s -l hash -d 'Only show SHA-1 hash'
2908complete -f -c git -n '__fish_git_using_command show-ref' -l verify -d 'Enable stricter reference checking'
2909complete -f -c git -n '__fish_git_using_command show-ref' -l abbrev -d 'Show abbreviated object names'
2910complete -f -c git -n '__fish_git_using_command show-ref' -s q -l quiet -d 'Do not print any results'
2911complete -f -c git -n '__fish_git_using_command show-ref' -l exclude-existing -d 'Check refs from stdin that do not exist'
2912
2913### symbolic-ref
2914complete -f -c git -n __fish_git_needs_command -a symbolic-ref -d 'Read, modify, delete symbolic refs'
2915complete -f -c git -n '__fish_git_using_command symbolic-ref' -s d -l delete -d 'Delete the symbolic ref'
2916complete -f -c git -n '__fish_git_using_command symbolic-ref' -s q -l quiet -d 'Do not issue error if ref is not a symbolic ref'
2917complete -f -c git -n '__fish_git_using_command symbolic-ref' -l short -d 'Shorten the ref name'
2918complete -x -c git -n '__fish_git_using_command symbolic-ref' -s m -d 'Update reflog with given reason'
2919
2920### check-ignore
2921complete -f -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a check-ignore -d 'Debug gitignore / exclude files'
2922complete -f -c git -n '__fish_git_using_command check-ignore' -s q -l quiet -d 'Do not output anything, just set exit status'
2923complete -f -c git -n '__fish_git_using_command check-ignore' -s v -l verbose -d 'Show matching pattern for each file'
2924complete -f -c git -n '__fish_git_using_command check-ignore' -l stdin -d 'Read pathnames from stdin'
2925complete -f -c git -n '__fish_git_using_command check-ignore' -s z -d 'NUL line termination'
2926complete -f -c git -n '__fish_git_using_command check-ignore' -s n -l non-matching -d 'Show given paths which do not match any pattern'
2927complete -f -c git -n '__fish_git_using_command check-ignore' -l no-index -d 'Do not look in the index when undertaking checks'
2928
2929### checkout-index
2930complete -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a checkout-index -d 'Copy files from index to working tree'
2931complete -f -c git -n '__fish_git_using_command checkout-index' -s a -l all -d 'Check out all files in the index'
2932complete -f -c git -n '__fish_git_using_command checkout-index' -s f -l force -d 'Force overwrite existing files'
2933complete -f -c git -n '__fish_git_using_command checkout-index' -s n -l no-create -d 'Do not create files that do not exist'
2934complete -f -c git -n '__fish_git_using_command checkout-index' -s q -l quiet -d 'Be quiet if files exist or are not in the index'
2935complete -f -c git -n '__fish_git_using_command checkout-index' -s u -l index -d 'Update stat information in the index'
2936complete -f -c git -n '__fish_git_using_command checkout-index' -s z -d 'NUL line termination'
2937complete -x -c git -n '__fish_git_using_command checkout-index' -l prefix -d 'Prefix to use when creating files'
2938complete -x -c git -n '__fish_git_using_command checkout-index' -l stage -a 'all 1 2 3' -d 'Which stage to check out'
2939complete -f -c git -n '__fish_git_using_command checkout-index' -l temp -d 'Write files to temporary files'
2940
2941### commit-tree
2942complete -f -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a commit-tree -d 'Create a new commit object'
2943complete -x -c git -n '__fish_git_using_command commit-tree' -s p -d 'Parent commit object'
2944complete -x -c git -n '__fish_git_using_command commit-tree' -s m -d 'Commit message'
2945complete -F -c git -n '__fish_git_using_command commit-tree' -s F -d 'Read commit message from file'
2946complete -x -c git -n '__fish_git_using_command commit-tree' -s S -l gpg-sign -d 'GPG-sign commit'
2947complete -f -c git -n '__fish_git_using_command commit-tree' -l no-gpg-sign -d 'Do not GPG-sign commit'
2948
2949### diff-index
2950complete -f -c git -n '__fish_git_needs_command && __fish_git_dash_in_token' -a diff-index -d 'Compare tree to working tree or index'
2951complete -f -c git -n '__fish_git_using_command diff-index' -l cached -d 'Compare tree to index'
2952complete -f -c git -n '__fish_git_using_command diff-index' -s m -d 'Ignore changes in submodules'
2953complete -f -c git -n '__fish_git_using_command diff-index' -l raw -d 'Generate raw diff output'
2954complete -f -c git -n '__fish_git_using_command diff-index' -s p -l patch -d 'Generate patch'
2955complete -f -c git -n '__fish_git_using_command diff-index' -s q -l quiet -d 'Disable diff output, only set exit status'
2956complete -f -c git -n '__fish_git_using_command diff-index' -a '(__fish_git_refs)' -d Ref
2957
2958### hash-object
2959complete -f -c git -n __fish_git_needs_command -a hash-object -d 'Compute object ID and optionally create an object'
2960complete -x -c git -n '__fish_git_using_command hash-object' -s t -a 'blob tree commit tag' -d 'Specify object type'
2961complete -f -c git -n '__fish_git_using_command hash-object' -s w -d 'Actually write object into object database'
2962complete -f -c git -n '__fish_git_using_command hash-object' -l stdin -d 'Read object from stdin'
2963complete -f -c git -n '__fish_git_using_command hash-object' -l stdin-paths -d 'Read file paths from stdin'
2964complete -F -c git -n '__fish_git_using_command hash-object' -l path -d 'Hash object as if it were at the given path'
2965complete -f -c git -n '__fish_git_using_command hash-object' -l no-filters -d 'Hash contents as-is, without any input filters'
2966complete -f -c git -n '__fish_git_using_command hash-object' -l literally -d 'Allow hashing any garbage'
2967
2968### read-tree
2969complete -f -c git -n __fish_git_needs_command -a read-tree -d 'Read tree info into the index'
2970complete -f -c git -n '__fish_git_using_command read-tree' -s m -d 'Perform a merge'
2971complete -f -c git -n '__fish_git_using_command read-tree' -l reset -d 'Same as -m, but discard unmerged entries'
2972complete -f -c git -n '__fish_git_using_command read-tree' -s u -d 'Update working tree with merge result'
2973complete -f -c git -n '__fish_git_using_command read-tree' -s i -d 'Update only the index, leave working tree alone'
2974complete -f -c git -n '__fish_git_using_command read-tree' -s n -l dry-run -d 'Do not update index or working tree'
2975complete -f -c git -n '__fish_git_using_command read-tree' -s v -d 'Show progress'
2976complete -f -c git -n '__fish_git_using_command read-tree' -l trivial -d 'Restrict three-way merge to trivial cases'
2977complete -f -c git -n '__fish_git_using_command read-tree' -l aggressive -d 'Try harder to resolve trivial cases'
2978complete -x -c git -n '__fish_git_using_command read-tree' -l prefix -d 'Read tree into subdirectory'
2979complete -f -c git -n '__fish_git_using_command read-tree' -l index-output -d 'Write index to specified file'
2980complete -f -c git -n '__fish_git_using_command read-tree' -l empty -d 'Instead of reading tree object, empty the index'
2981complete -f -c git -n '__fish_git_using_command read-tree' -l no-sparse-checkout -d 'Disable sparse checkout support'
2982complete -f -c git -n '__fish_git_using_command read-tree' -a '(__fish_git_refs)' -d Ref
2983
2984### update-ref
2985complete -f -c git -n __fish_git_needs_command -a update-ref -d 'Update object name stored in a ref safely'
2986complete -f -c git -n '__fish_git_using_command update-ref' -s d -d 'Delete the reference'
2987complete -f -c git -n '__fish_git_using_command update-ref' -l no-deref -d 'Do not dereference symbolic refs'
2988complete -x -c git -n '__fish_git_using_command update-ref' -s m -d 'Update reflog with given reason'
2989complete -f -c git -n '__fish_git_using_command update-ref' -l create-reflog -d 'Create a reflog'
2990complete -f -c git -n '__fish_git_using_command update-ref' -l stdin -d 'Read instructions from stdin'
2991complete -f -c git -n '__fish_git_using_command update-ref' -s z -d 'NUL-terminated format for stdin'
2992
2993### verify-commit
2994complete -f -c git -n __fish_git_needs_command -a verify-commit -d 'Check the GPG signature of commits'
2995complete -f -c git -n '__fish_git_using_command verify-commit' -ka '(__fish_git_commits)'
2996complete -f -c git -n '__fish_git_using_command verify-commit' -s v -l verbose -d 'Print commit contents'
2997complete -f -c git -n '__fish_git_using_command verify-commit' -l raw -d 'Print raw gpg status output'
2998
2999### verify-pack
3000complete -f -c git -n __fish_git_needs_command -a verify-pack -d 'Validate packed Git archive files'
3001complete -f -c git -n '__fish_git_using_command verify-pack' -s v -l verbose -d 'Show objects contained in pack'
3002complete -f -c git -n '__fish_git_using_command verify-pack' -s s -l stat-only -d 'Only show histogram of delta chain length'
3003
3004### verify-tag
3005complete -f -c git -n __fish_git_needs_command -a verify-tag -d 'Check the GPG signature of tags'
3006complete -f -c git -n '__fish_git_using_command verify-tag' -ka '(__fish_git_tags)'
3007complete -f -c git -n '__fish_git_using_command verify-tag' -s v -l verbose -d 'Print tag contents'
3008complete -f -c git -n '__fish_git_using_command verify-tag' -l raw -d 'Print raw gpg status output'
3009complete -x -c git -n '__fish_git_using_command verify-tag' -l format -d 'Format to use for the output'
3010
3011### write-tree
3012complete -f -c git -n __fish_git_needs_command -a write-tree -d 'Create a tree object from the current index'
3013complete -f -c git -n '__fish_git_using_command write-tree' -l missing-ok -d 'Allow missing objects'
3014complete -x -c git -n '__fish_git_using_command write-tree' -l prefix -d 'Write a tree object for a subdirectory'
3015
3016## Custom commands (git-* commands installed in the PATH)
3017complete -c git -n __fish_git_needs_command -a '(__fish_git_custom_commands)' -d 'Custom command'
3018
3019function __fish_git_complete_custom_command -a subcommand
3020    set -l cmd (commandline -xpc)
3021    set -e cmd[1] # Drop "git".
3022    set -l subcommand_args
3023    if argparse -s (__fish_git_global_optspecs) -- $cmd
3024        set subcommand_args (string escape -- $argv[2..]) # Drop the subcommand.
3025    end
3026    complete -C "git-$subcommand $subcommand_args "(commandline -ct)
3027end
3028
3029# source git-* commands' autocompletion file if exists
3030set -l __fish_git_custom_commands_completion
3031set -l git_subcommands $PATH/git-*
3032for file in (path filter -xZ $git_subcommands | path basename)
3033    # Already seen this command earlier in $PATH.
3034    contains -- $file $__fish_git_custom_commands_completion
3035    and continue
3036
3037    # Running `git foo` ends up running `git-foo`, so we need to ignore the `git-` here.
3038    set -l cmd (string replace -r '^git-' '' -- $file | string escape)
3039    complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)"
3040    set -a __fish_git_custom_commands_completion $file
3041end
3042
3043functions --erase __fish_git_add_revision_completion
3044set -eg __fish_git_recent_commits_arg
3045set -eg __fish_git_unqualified_unique_remote_branches
3046set -eg __fish_git_filter_non_pushable