about summary refs log tree commit diff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git992
1 files changed, 672 insertions, 320 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 7c7fb22bc..7370aaead 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -68,22 +68,29 @@ _git-add () {
     '--refresh[do not add files, but refresh their stat() info in index]' \
     '--ignore-errors[continue adding if an error occurs]' \
     $ignore_missing \
-    '--chmod[override the executable bit of the listed files]:override:(-x +x)' \
+    '--sparse[allow updating entries outside of sparse-checkout cone]' \
+    '--chmod=[override the executable bit of the listed files]:override:(-x +x)' \
+    '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+    '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
     '*:: :->file' && return
 
   case $state in
     (file)
-      declare -a ignored_files_alternatives
+      declare -a file_alternatives
+      if [[ -z ${opt_args[(I)-u|--update]} ]]; then
+        file_alternatives=(
+          'other-files::__git_ignore_line_inside_arguments __git_other_files'
+        )
+      fi
       if [[ -n ${opt_args[(I)-f|--force]} ]]; then
-        ignored_files_alternatives=(
+        file_alternatives+=(
           'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored'
           'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored')
       fi
 
       _alternative \
         'modified-files::__git_ignore_line_inside_arguments __git_modified_files' \
-        'other-files::__git_ignore_line_inside_arguments __git_other_files' \
-        $ignored_files_alternatives && ret=0
+        $file_alternatives && ret=0
       ;;
   esac
 
@@ -97,11 +104,8 @@ _git-am () {
 
   # NOTE: --rebasing and --resolvemsg are only for internal use between git
   # rebase and git am.
-  # TODO: --patch-format is undocumented.
-  # TODO: --rerere-autoupdate and --no-rerere-autoupdate are
-  # undocumented (and not implemented here).
   _arguments -s -S $endopt \
-    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \
+    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
     '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
     "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
     '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \
@@ -111,14 +115,18 @@ _git-am () {
     '(--keep-cr             )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \
     '(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \
     '(-c --scissors --no-scissors)--no-scissors[ignore scissors lines]' \
+    '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \
     '(-q --quiet)'{-q,--quiet}'[only print error messages]' \
     '(-u --utf8 --no-utf8)'{-u,--utf8}'[pass -u to git mailinfo]' \
     '(-u --utf8 --no-utf8)--no-utf8[pass -n to git mailinfo]' \
     '(-3 --3way)'{-3,--3way}'[use 3-way merge if patch does not apply cleanly]' \
     $apply_options \
     '--quit[abort the patching operation but keep HEAD where it is]' \
-    '--show-current-patch[show the patch being applied]' \
+    '--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \
+    '(--empty)--allow-empty[record the empty patch as an empty commit]' \
+    '(--allow-empty)--empty=[select hanndling of empty patches]:handling:(stop drop keep)' \
     '(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \
+    '(-n --no-verify)'{-n,--no-verify}'[bypass pre-applypatch and applypatch-msg hooks]' \
     '--committer-date-is-author-date[use author date as committer date]' \
     '--ignore-date[use committer date as author date]' \
     '--skip[skip the current patch]' \
@@ -159,7 +167,10 @@ _git-archive () {
     '--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
     '(- :)'{-l,--list}'[list available archive formats]' \
     '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
+    '--mtime=[set modification time of archive entries]:mtime' \
     '--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
+    '--add-file=[add untracked file to archive]:file:_files' \
+    '--add-virtual-file=[add untracked file to archive]:path:_files' \
     '(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \
     '--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
     $backend_args \
@@ -179,8 +190,6 @@ _git-archive () {
 
 (( $+functions[_git-bisect] )) ||
 _git-bisect () {
-  # TODO: next subcommand is undocumented.  Git-bisect.sh mentions that the
-  # subcommand might be removed from the UI level.
   local curcontext=$curcontext state line ret=1
   declare -A opt_args
   local good bad
@@ -226,6 +235,7 @@ _git-bisect () {
 	    --term-{good,old}'=[specify alternate term for good revisions]:term' \
 	    --term-{bad,new}'=[specify alternate term for bad revisions]:term' \
 	    '--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \
+            '--first-parent[follow only the first parent commit upon seeing a merge commit]' \
             ':bad revision:__git_commits' \
             '*: :->revision-or-path' && ret=0
           case $state in
@@ -323,12 +333,13 @@ _git-branch () {
     "($c $m     -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \
     "($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \
     "($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
-    "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
+    "($c $m $d :)--abbrev=[use specified digits to display object names]:digits" \
     "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \
     "(- :)--show-current[show current branch name]" \
     "($l $m $d)--create-reflog[create the branch's reflog]" \
     "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
-    "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \
+    "($l $m $d --track)-t[setup configuration so that pull merges from the start point]" \
+    "($l $m $d -t)--track=-[setup configuration so that pull merges from the start point]::upstream tracking:(direct inherit)" \
     "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
     "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \
     "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
@@ -340,6 +351,7 @@ _git-branch () {
     $dependent_creation_args \
     "($l $c $d $m)"{-m,--move}"[rename a branch and the corresponding reflog]" \
     "($l $c $d $m)-M[rename a branch even if the new branch-name already exists]" \
+    "--omit-empty[don't output a newline after empty formatted refs]" \
     "($l $c $d $m)"{-c,--copy}"[copy a branch and the corresponding reflog]" \
     "($l $c $d $m)-C[copy a branch even if the new branch-name already exists]" \
     $dependent_modification_args \
@@ -349,6 +361,7 @@ _git-branch () {
     '*--sort=[specify field to sort on]: :__git_ref_sort_keys' \
     '--points-at=[only list tags of the given object]: :__git_commits' \
     "($c $m $d -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
+    "($l $m $d)--recurse-submodules[recurse through submodules]" \
     $dependent_deletion_args
 }
 
@@ -380,10 +393,14 @@ _git-bundle () {
         (create)
           if (( CURRENT == 2 )); then
             _arguments \
+              '(-q --quiet)'{-q,--quiet}"[don't show progress]" \
+              '--progress[show progress meter]' \
+              \!--all-progress{,-implied} \
+              '--version=[specify bundle format version]:version:(2 3)' \
               ':bundle:_files' && ret=0
           else
             local revision_options
-            __git_setup_revision_options
+            __git_setup_revision_options -d
 
             _arguments -S -s \
               $revision_options \
@@ -393,13 +410,20 @@ _git-bundle () {
           ;;
         (verify)
           _arguments \
+            '(-q --quiet)'{-q,--quiet}"[don't show bundle details]" \
             ':bundle:_files' && ret=0
           ;;
-        (list-heads|unbundle)
+        (list-heads)
           _arguments \
             ':bundle:_files' \
             '*: :__git_references' && ret=0
-          ;;
+        ;;
+        (unbundle)
+          _arguments \
+            '--progress[show progress meter]' \
+            ':bundle:_files' \
+            '*: :__git_references' && ret=0
+        ;;
       esac
       ;;
   esac
@@ -451,13 +475,14 @@ _git-checkout () {
     '(-q --quiet -2 --ours -3 --theirs --patch)'{-3,--theirs}'[check out stage #3 for unmerged paths]' \
     '(   -B --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \
     '(-b    --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \
-    '(-t --track --orphan --patch -d --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \
+    '(--track --no-track --orphan --patch -d --detach)-t[set upstream info for new branch]' \
+    '(-t --no-track --orphan --patch -d --detach)--track=-[set upstream info for new branch]::configuration:(direct inherit)' \
     '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \
     $new_branch_reflog_opt \
     '(-b -B -t --track --patch --orphan -d --detach)'{-d,--detach}'[detach the HEAD at named commit]' \
     '(-b -B -t --track --patch -d --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \
     '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \
-    '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \
+    '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3 zdiff3)' \
     '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \
     "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
     "--no-guess[don't second guess 'git checkout <no-such-branch>']" '!(--no-guess)--guess' \
@@ -466,6 +491,8 @@ _git-checkout () {
     '--no-overlay[remove files from index or working tree that are not in the tree-ish]' \
     '(-q --quiet --progress)--no-progress[suppress progress reporting]' \
     '--progress[force progress reporting]' \
+    '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+    '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
     '(-)--[start file arguments]' \
     '*:: :->branch-or-tree-ish-or-file' && ret=0
 
@@ -514,10 +541,7 @@ _git-cherry-pick () {
   local -a git_commit_opts
   git_commit_opts=(--all --not HEAD --not)
   _arguments \
-    '(- :)--quit[end revert or cherry-pick sequence]' \
-    '(- :)--continue[resume revert or cherry-pick sequence]' \
-    '(- :)--skip[skip current commit and continue]' \
-    '(- :)--abort[cancel revert or cherry-pick sequence]' \
+    - init \
     '--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \
     '--allow-empty[preserve initially empty commits]' \
     '--allow-empty-message[allow replaying a commit with an empty message]' \
@@ -525,15 +549,21 @@ _git-cherry-pick () {
     '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the cherry-pick]' \
     '(--ff)-x[append information about what commit was cherry-picked]' \
     '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \
-    '--rerere-autoupdate[update index with reused conflict resolution if possible]' \
+    '(--no-rerere-autoupdate)--rerere-autoupdate[update index with reused conflict resolution if possible]' \
+    '(--rerere-autoupdate)--no-rerere-autoupdate' \
     '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \
-    '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
+    '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
     '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
     "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
-    '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
-    '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
+    '*--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \
+    '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
     '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
-    '*: : __git_commit_ranges -O expl:git_commit_opts'
+    '*: : __git_commit_ranges -O expl:git_commit_opts' \
+    - '(sequencer)' \
+    '--quit[end revert or cherry-pick sequence]' \
+    '--continue[resume revert or cherry-pick sequence]' \
+    '--skip[skip current commit and continue]' \
+    '--abort[cancel revert or cherry-pick sequence]' \
 }
 
 (( $+functions[_git-citool] )) ||
@@ -548,7 +578,7 @@ _git-clean () {
 
   _arguments -C -S -s $endopt \
     '-d[also remove untracked directories]' \
-    '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \
+    \*{-f,--force}'[required by default; twice, removes untracked nested repositories]' \
     '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \
     '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \
     '(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \
@@ -618,6 +648,7 @@ _git-clone () {
     '(-q --quiet)'{-q,--quiet}'[operate quietly]' \
     '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \
     '--progress[output progress even if stderr is not a terminal]' \
+    "--reject-shallow[don't clone shallow repository]" \
     '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \
     '(-o --origin)--bare[make a bare GIT repository]' \
     '(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \
@@ -626,22 +657,24 @@ _git-clone () {
     '(-u --upload-pack)'{-u+,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \
     '--template=[directory to use as a template for the object database]: :_directories' \
     '*'{-c,--config}'[<key>=<value> set a configuration variable in the newly created repository]' \
-    '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
-    '--shallow-since=[shallow clone since a specific time]:time' \
-    '*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \
+    '(--bundle-uri)--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
+    '(--bundle-uri)--shallow-since=[shallow clone since a specific time]:time' \
+    '(--bundle-uri)*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \
     '(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \
     '(--single-branch)--no-single-branch[clone history leading up to each branch]' \
     "--no-tags[don't clone any tags and make later fetches not follow them]" \
     '--shallow-submodules[any cloned submodules will be shallow]' \
     '--recursive[initialize all contained submodules]' \
-    '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \
+    '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \
     '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \
     \*--server-option='[send specified string to the server when using protocol version 2]:option' \
     '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
     '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
     '--filter=[object filtering]:filter:_git_rev-list_filters' \
+    '--also-filter-submodules[apply partial clone filters to submodules]' \
     '--remote-submodules[any cloned submodules will use their remote-tracking branch]' \
     '--sparse[initialize the sparse-checkout file to start with only the top-level files]' \
+    '(--depth --shallow-since --shallow-exclude)--bundle-uri=[before fetching, get a bundle from specified location]:uri:_urls' \
     ': :->repository' \
     ': :_directories' && ret=0
 
@@ -685,7 +718,7 @@ _git-commit () {
   # TODO: --interactive isn't explicitly listed in the documentation.
   _arguments -S -s $endopt \
     '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \
-    '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \
+    '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:_git_fixup' \
     '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \
     $reset_author_opt \
     '(        --porcelain --dry-run)--short[dry run with short output format]' \
@@ -694,10 +727,11 @@ _git-commit () {
     "--no-ahead-behind[don't display detailed ahead/behind counts relative to upstream branch]" \
     '(--short             --dry-run)--porcelain[dry run with machine-readable output format]' \
     '(--short --porcelain --dry-run -z --null)'{-z,--null}'[dry run with NULL-separated output format]' \
-    {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \
+    {-p,--patch}'[use the interactive patch selection interface to choose which changes to commit]' \
     '(--reset-author)--author[override the author name used in the commit]:author name' \
     '--date=[override the author date used in the commit]:date' \
-    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
+    '*--trailer=[add custom trailer(s)]:trailer:__git_trailers_tokens' \
+    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
     '(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \
     '--allow-empty[allow recording an empty commit]' \
     '--allow-empty-message[allow recording a commit with an empty message]' \
@@ -705,11 +739,13 @@ _git-commit () {
     '(-e --edit --no-edit)'{-e,--edit}'[edit the commit message before committing]' \
     '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing]' \
     '--no-post-rewrite[bypass the post-rewrite hook]' \
-    '(-a --all --interactive -o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \
-    '(-a --all --interactive -o --only -i --include)'{-o,--only}'[commit only the given files]' \
+    '(-a --all --interactive -o --only)*'{-i,--include}'[update the given files and commit the whole index]' \
+    '(-a --all --interactive -i --include)*'{-o,--only}'[commit only the given files]' \
     '(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files"
                                                                                                   normal\:"show untracked files and directories"
                                                                                                   all\:"show individual files in untracked directories"))' \
+    '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+    '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
     '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \
     '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \
     '--dry-run[only show list of paths that are to be committed or not, and any untracked]' \
@@ -724,7 +760,7 @@ _git-commit () {
       {-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \
       {-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \
       {-F+,--file=}'[read commit message from given file]: :_files' \
-      {-m+,--message=}'[use the given message as the commit message]:message' \
+      \*{-m+,--message=}'[use the given message as the commit message]:message' \
       {-t+,--template=}'[use file as a template commit message]:template:_files'
 }
 
@@ -736,7 +772,7 @@ _git-describe () {
     '--all[use any ref found in "$GIT_DIR/refs/"]' \
     '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \
     '(--tags)--contains[find the tag after the commit instead of before]' \
-    '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+    '--abbrev=[use specified digits to display object names]:digits' \
     '(             --exact-match)--candidates=[consider up to given number of candidates]: :__git_guard_number "number of candidates"' \
     '(--candidates              )--exact-match[only output exact matches, same as --candidates=0]' \
     '--debug[display information about the searching strategy]' \
@@ -760,6 +796,7 @@ _git-diff () {
   _arguments -C -s $endopt \
     $* \
     $diff_options \
+    '--exit-code[report exit code 1 if differences, 0 otherwise]' \
     '(--exit-code)--quiet[disable all output]' \
     $diff_stage_options \
     '(--cached --staged)--no-index[show diff between two paths on the filesystem]' \
@@ -789,18 +826,6 @@ _git-diff () {
 
       # Otherwise, more complex conditions need to be checked.
       case $CURRENT in
-        (1)
-          local files_alt='files::__git_changed-in-working-tree_files'
-          if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
-            files_alt='files::__git_changed-in-index_files'
-          fi
-
-          _alternative \
-            'commit-ranges::__git_commit_ranges' \
-            'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
-            $files_alt \
-            'blobs::__git_blobs ' && ret=0
-          ;;
         (2)
           # Check if first argument is something special. In case of committish ranges and committishs offer a full list compatible completions.
           if __git_is_committish_range $line[1]; then
@@ -822,10 +847,19 @@ _git-diff () {
           elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
             # Example: git diff --cached file1 <tab>
             __git_changed-in-index_files && ret=0
-          else
-            # Example: git diff file1 <tab>
-            __git_changed-in-working-tree_files && ret=0
           fi
+          ;&
+        (1)
+          local files_alt='files::__git_changed-in-working-tree_files'
+          if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+            files_alt='files::__git_changed-in-index_files'
+          fi
+
+          _alternative \
+            'commit-ranges::__git_commit_ranges' \
+            'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
+            $files_alt \
+            'blobs::__git_blobs ' && ret=0
           ;;
         (*)
           if __git_is_committish_range $line[1]; then
@@ -870,16 +904,18 @@ _git-fetch () {
 
   _arguments -C -S -s $endopt \
     $fetch_options \
-    '--shallow-since=[deepen history of shallow repository based on time]:time' \
-    '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \
-    '--deepen[deepen history of shallow clone]:number of commits' \
-    '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
+    '--atomic[use atomic transaction to update references]' \
     '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \
+    '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
+    '--prefetch[modify the refspec to place all refs within refs/prefetch/]' \
+    '--refetch[fetch all objects as a fresh clone would]' \
     '(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \
-    \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \
-    '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \
+    '--write-fetch-head[write fetched references to the FETCH_HEAD file]' \
+    "--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \
     '--filter=[object filtering]:filter:_git_rev-list_filters' \
-    "--auto-gc[run 'gc --auto' after fetching]" \
+    '(--auto-maintenance --auto-gc)'--auto-{maintenance,gc}"[run 'maintenance --auto' after fetching]" \
+    '--write-commit-graph[write the commit-graph after fetching]' \
+    '--stdin[accept refspecs from stdin]' \
     '*:: :->repository-or-group-or-refspec' && ret=0
 
   case $state in
@@ -919,7 +955,7 @@ _git-format-patch () {
     '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \
     '--numbered-files[use only number for file name]' \
     '(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \
-    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \
+    '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
     '(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \
     '(         --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \
     '(--attach             --inline)--no-attach[disable creation of attachments]' \
@@ -930,7 +966,9 @@ _git-format-patch () {
     '--in-reply-to=[make the first mail a reply to the given message]:message id' \
     '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
     '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \
+    '--filename-max-length=[specify max length of output filename]:length' \
     '(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \
+    "--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \
     '(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
     '*--to=[add To: header to email headers]: :_email_addresses' \
     '*--cc=[add Cc: header to email headers]: :_email_addresses' \
@@ -950,6 +988,7 @@ _git-format-patch () {
     '--interdiff=[insert interdiff against previous patch series in cover letter or single patch]:reference to tip of previous series:__git_revisions' \
     '--range-diff=[insert range-diff against previous patch series in cover letter or single patch]:reference to tip ot previous series:__git_revisions' \
     '--creation-factor=[for range-diff, specify weighting for creation]:weighting (percent)' \
+    '--force-in-body-from[show in-body From: even if identical to the e-mail header]' \
     ': :->commit-or-commit-range' && ret=0
 
   case $state in
@@ -970,8 +1009,9 @@ _git-gc () {
   _arguments -S -s $endopt \
     '--aggressive[more aggressively optimize]' \
     '--auto[check whether housekeeping is required]' \
-    '(        --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:__git_datetimes' \
+    '(        --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:_git_approxidates' \
     '(--prune           )--no-prune[do not prune any loose objects]' \
+    '--cruft[pack unreferenced objects separately]' \
     '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \
     '--keep-largest-pack[repack all other packs except the largest pack]' \
 }
@@ -1034,6 +1074,7 @@ _git-grep () {
     '--threads=[use specified number of threads]:number of threads' \
     '(-c --count -p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \
     '(-c --count -W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \
+    '(-m --max-count)'{-m+,--max-count=}'[specify maximum number of results per file]:results' \
     '(1)*-f+[read patterns from given file]:pattern file:_files' \
     '(1)*-e+[use the given pattern for matching]:pattern' \
     $pattern_operators \
@@ -1148,6 +1189,8 @@ _git-init () {
     '--template=[directory to use as a template for the object database]: :_directories' \
     '--shared=[share repository amongst several users]:: :__git_repository_permissions' \
     '--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \
+    '(-b --initial-branch)'{-b+,--initial-branch=}'[override the name of the initial branch]:branch name' \
+    '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
     ':: :_directories'
 }
 
@@ -1249,6 +1292,9 @@ _git-maintenance() {
             "--quiet[don't report progress or other information to stderr]" \
             '*--task=[run a specific task]:task:(gc commit-graph prefetch loose-objects incremental-repack pack-refs)' && ret=0
         ;;
+        (start)
+          _arguments \
+            '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)'
       esac
     ;;
   esac
@@ -1266,6 +1312,7 @@ _git-merge () {
     $merge_options \
     \*{-m+,--message=}'[set the commit message to be used for the merge commit]:merge message' \
     \*{-F+,--file=}'[read commit message from a file]:file' \
+    '--into-name=[use specified name instead of the real target]:branch name:__git_branch_names' \
     '(--edit --no-edit)-e[open an editor to change the commit message]' \
     '(                    --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \
     '(--rerere-autoupdate                       )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \
@@ -1287,6 +1334,7 @@ _git-mv () {
     '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \
     '-k[skip rename/move that would lead to errors]' \
     '(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \
+    '--sparse[allow updating entries outside of sparse-checkout cone]' \
     ':source:__git_cached_files' \
     '*:: :->source-or-destination' && ret=0
 
@@ -1304,6 +1352,7 @@ _git-mv () {
 (( $+functions[_git-notes] )) ||
 _git-notes () {
   local curcontext=$curcontext state line ret=1
+  local -a args
   declare -A opt_args
 
   _arguments -C $endopt \
@@ -1341,16 +1390,21 @@ _git-notes () {
         (add)
           # TODO: Only complete commits that don't have notes already, unless
           # -f or --force has been given.
-          _arguments -S -s $endopt \
+          args=( '(-f --force)'{-f,--force}'[overwrite existing note]' )
+        ;&
+        (append)
+          _arguments -S -s $endopt $args \
             '*'{-m+,--message=}'[use given note message]:message' \
             '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \
             '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \
             '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \
-            '(-f --force)'{-f,--force}'[overwrite existing note]' \
+            '--allow-empty[allow storing empty note]' \
+            '(--no-separator)--separator=-[insert text between paragraphs]::paragraph break' \
+            '(--separator)--no-separator' \
+            '--stripspace[remove unnecessary whitespace]' \
             ': :__git_commits' && ret=0
           ;;
         (copy)
-          # TODO: --for-rewrite is undocumented.
           _arguments -S -s $endopt \
             '(-f --force)'{-f,--force}'[replace existing note]' \
             '(:)--stdin[read objects from stdin]' \
@@ -1378,14 +1432,6 @@ _git-notes () {
 	(remove)
 	  _arguments -S $endopt --ignore-missing --stdin ':object:__git_commits' && ret=0
 	  ;;
-        (append)
-          _arguments -S -s $endopt \
-            '*'{-m+,--message=}'[use given note message]:message' \
-            '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \
-            '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \
-            '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \
-            ': :__git_commits' && ret=0
-          ;;
         (get-ref)
           _nothing
           ;;
@@ -1415,7 +1461,6 @@ _git-pull () {
       interactive\:"allow list of commits to be edited"
     ))' \
     '(-r --rebase            )--no-rebase[do not perform a rebase after fetching]' \
-    '--autostash[automatically stash/stash pop before and after rebase]' \
     $fetch_options \
     '(--no-tags -t --tags)--no-tags[disable automatic tag following]' \
     ': :__git_any_repositories' \
@@ -1435,18 +1480,27 @@ _git-push () {
   # only complete files on the local end, not the remote end.  Still, it may be
   # helpful to get some sort of completion going, perhaps modifying the path
   # later on to match the remote end.
+
+  local ref_arg
+  if (( words[(I)-d|--delete] )); then
+      ref_arg='*: :__git_remote_branch_names_noprefix'
+  else
+      ref_arg='*: :__git_ref_specs_pushy'
+  fi
+
   _arguments -S -s $endopt \
-    '--all[push all refs under refs/heads/]' \
+    '(* --all --branches --mirror --tags)'{--all,--branches}'[push all branches]' \
     '--prune[remove remote branches that do not have a local counterpart]' \
-    '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
+    '(* --all --branches --tags)--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
     '(-n --dry-run)'{-n,--dry-run}'[do everything except actually send the updates]' \
     '--porcelain[produce machine-readable output]' \
     '(-d --delete)'{-d,--delete}'[delete all listed refs from the remote repository]' \
-    '--tags[all tags under refs/tags are pushed]' \
+    '(* --all --branches --mirror)--tags[all tags under refs/tags are pushed]' \
     '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \
     '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \
     '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \
     '(--force-with-lease --no-force-with-lease)--no-force-with-lease[cancel all previous force-with-lease specifications]' \
+    '--force-if-includes[require remote updates to be integrated locally]' \
     '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \
     '(:)--repo=[default repository to use]:repository:__git_any_repositories' \
     '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \
@@ -1465,11 +1519,11 @@ _git-push () {
     '(--no-signed --sign)--signed[GPG sign the push]' \
     "(--sign --signed)--no-signed[don't GPG sign the push]" \
     '--atomic[request atomic transaction on remote side]' \
-    '(-o --push-option)'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \
+    '*'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \
     '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
     '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
     ': :__git_any_repositories' \
-    '*: :__git_ref_specs_pushy' && ret=0
+    $ref_arg && ret=0
 
   case $state in
     (lease)
@@ -1493,6 +1547,9 @@ _git-range-diff () {
   _arguments -s -S $endopt \
     '--creation-factor=[specify weighting for creation]:weighting (percent)' \
     '--no-dual-color[use simple diff colors]' \
+    '(--no-notes)*--notes=[show notes that annotate commit, with optional ref argument show this notes ref instead of the default notes ref(s)]:: :__git_notes_refs' \
+    '(--right-only)--left-only[only emit output related to the first range]' \
+    '(--left-only)--right-only[only emit output related to the second range]' \
     $diff_options \
     '1:range 1:__git_commit_ranges' \
     '2:range 2:__git_commit_ranges' \
@@ -1518,38 +1575,40 @@ _git-rebase () {
     '(-)--quit[abort but keep HEAD where it is]' \
     '(-)--show-current-patch[show the patch file being applied or merged]' \
     - options \
-    '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \
+    '(--onto --root)--keep-base[use the merge-base of upstream and branch as the current base]' \
     '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
     "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
-    '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
-    '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
     '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \
     '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \
     '(-n --no-stat)'{-n,--no-stat}"[don't show diffstat of what changed upstream]" \
     '--rerere-autoupdate[update the index with reused conflict resolution if possible]' \
     '--no-verify[bypass the pre-rebase hook]' \
-    '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \
+    '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \
     '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \
-    '(-i --interactive)--ignore-whitespace[ignore whitespace in context]' \
-    '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \
+    '(-i --interactive)--ignore-whitespace[ignore changes in whitespace]' \
+    '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \
     '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \
-    '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
-    '(-r --rebase-merges)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \
-    '!(-p --preserve-merges --interactive)'{-p,--preserve-merges} \
-    {-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \
-    '(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \
-    '--allow-empty-message[allow rebasing commits with empty messages]' \
-    '(1)--root[rebase all reachable commits]' \
+    '(-f --force-rebase)'{--ignore-date,--reset-author-date}'[ignore author date and use current date]' \
+    '(-m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--apply[use apply strategies to rebase]' \
+    '(-m --merge --apply --whitespace -C)'{-m,--merge}'[use merging strategies to rebase]' \
+    '(-i --interactive --ignore-whitespace --apply --whitespace -C --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
+    '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep ask)' \
+    '(--apply --whitespace -C)'{-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \
+    '(-r --rebase-merges --apply --whitespace -C)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \
+    '(--apply --whitespace -C)*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
+    '(--apply --whitespace -C)*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
+    '(1 --keep-base --fork-point)--root[rebase all reachable commits]' \
     $autosquash_opts \
     '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \
     "(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \
-    '--fork-point[use merge-base --fork-point to refine upstream]' \
-    '--ignore-date[use current timestamp for author date]' \
-    '--signoff[add Signed-off-by: line to the commit message]' \
+    '(--root)--fork-point[use merge-base --fork-point to refine upstream]' \
+    '--signoff[add Signed-off-by: trailer to the commit message]' \
     '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \
     '(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \
-    '(--onto)--keep-base[use the merge-base of upstream and branch as the current base]' \
-    "--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \
+    "(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \
+    '(--apply --whitespace -C)--reapply-cherry-picks[apply all changes, even those already present upstream]' \
+    '--update-refs[update branches that point to commits that are being rebased]' \
+    '!(--update-refs)--no-update-refs' \
     ':upstream branch:__git_revisions' \
     '::working branch:__git_revisions'
 }
@@ -1569,6 +1628,9 @@ _git-reset () {
       '--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \
       '(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \
       '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
+      '--no-refresh[skip refreshing the index after reset]' \
+      '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+      '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
       '(--soft --mixed --hard --merge --keep):: :__git_commits' \
       '(--soft --mixed --hard --merge --keep)*:: :->file' && ret=0
 
@@ -1606,11 +1668,13 @@ _git-restore() {
     '(-q --quiet --progress)--no-progress[suppress progress reporting]' \
     '(--no-progress)--progress[force progress reporting]' \
     '(-m --merge)'{-m,--merge}'[perform a 3-way merge with the new branch]' \
-    '--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \
+    '--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3 zdiff3)' \
     '(-2 --ours -3 --theirs -m --merge)'{-2,--ours}'[checkout our version for unmerged files]' \
     '(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \
     '(-p --patch)'{-p,--patch}'[select hunks interactively]' \
     "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
+    '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+    '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
     '*:path spec:->pathspecs' && ret=0
 
   case $state in
@@ -1653,9 +1717,10 @@ _git-revert () {
     '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \
     '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
     '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \
-    '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
+    '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
     '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
     "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
+    "--reference[use the 'reference' format to refer to commits in log message]" \
     ': :__git_recent_commits'
 }
 
@@ -1670,6 +1735,9 @@ _git-rm () {
     '-r[allow recursive removal when a leading directory-name is given]' \
     '--cached[only remove files from the index]' \
     '--ignore-unmatch[exit with 0 status even if no files matched]' \
+    '--sparse[allow updating entries outside of sparse-checkout cone]' \
+    '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+    '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
     '(-q --quiet)'{-q,--quiet}"[don't list removed files]" \
     '*:: :->file' && ret=0
 
@@ -1698,6 +1766,8 @@ _git-shortlog () {
     '(-s --summary)'{-s,--summary}'[suppress commit description]' \
     '(-e --email)'{-e,--email}'[show email address of each author]' \
     '-w-[linewrap the output]:: :->wrap' \
+    '*--group=[group commits by field]: : _values -S\: field author committer trailer\:trailer' \
+    '(-c --committer)'{-c,--committer}'[alias for --group=committer]' \
     $revision_options \
     '(-)--[start file arguments]' \
     '*:: :->commit-range-or-file' && ret=0
@@ -1793,6 +1863,7 @@ _git-sparse-checkout() {
         add:'update the sparse-checkout file to include additional patterns'
         reapply:'reapply the sparsity pattern rules to paths in the working tree'
         disable:'disable the config setting, and restore all files in the working directory'
+        check-rules:'check whether sparsity rules match one or more paths'
       )
 
       _describe -t commands command commands && ret=0
@@ -1803,13 +1874,22 @@ _git-sparse-checkout() {
         init)
           _arguments \
             '--cone[allow for better performance with a limited set of patterns]' \
-            '--no-sparse-index[rewrite index to not be sparse]'
+            '--no-sparse-index[rewrite index to not be sparse]' && ret=0
         ;;
         set|add)
           _arguments -S \
-            '--stdin[read patterns from input]' \
+            '--cone[initialize the sparse-checkout in cone mode]' \
+            '--sparse-index[toggle the use of a sparse index]' \
+            '--skip-checks[skip some sanity checks on the given paths that might give false positives]' \
+            '(*)--stdin[read patterns from input]' \
             '*:pattern:_files' && ret=0
         ;;
+        check-rules)
+          _arguments \
+           '-z[terminate input and output files by a NUL character]' \
+           '--cone[interpret rules file patterns as cone mode patterns]' \
+           '--rules-file=[use patterns in specified file]:file:_files' && ret=0
+        ;;
       esac
     ;;
   esac
@@ -1828,13 +1908,16 @@ _git-stash () {
     '(-k --keep-index --no-keep-index)'{-k,--keep-index}'[all changes already added to the index are left intact]'
     '(-k --keep-index)--no-keep-index[all changes already added to the index are undone]'
     '(-q --quiet)'{-q,--quiet}'[suppress all output]'
-    '(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]'
-    '(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]'
+    '(-p --patch -a --all -u --include-untracked -S --staged)'{-u,--include-untracked}'[include untracked files]'
+    '(-p --patch -a --all -u --include-untracked -S --staged)'{-a,--all}'[include ignored files]'
+    '(* -p --patch)--pathspec-from-file=[read pathspec from file]:file:_files'
+    '(* -p --patch)--pathspec-file-nul[pathspec elements are separated with NUL character]'
+    '(-S --staged -a --all -u --include-untracked)'{-S,--staged}'[only stash changes that are currently staged]'
   )
 
   _arguments -C \
     '*::: :->args' \
-    '(-m --message)'{-m,--message}'[specify stash description]' \
+    '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
     ${save_arguments//#\(/(* } && ret=0
 
   if [[ -n $state ]]; then
@@ -1851,6 +1934,7 @@ _git-stash () {
         clear:'remove all the stashed states'
         drop:'remove a single stashed state from the stash list'
         create:'create a stash without storing it in the ref namespace'
+        store:'store a stash created with git stash create in the stash ref'
       )
 
       _describe -t commands command commands && ret=0
@@ -1867,8 +1951,8 @@ _git-stash () {
         (push)
           _arguments -S $endopt \
             $save_arguments \
-	    '(-m --message)'{-m,--message}'[specify stash description]' \
-            ':: :__git_modified_files' && ret=0
+            '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
+            '*: : __git_ignore_line __git_modified_files' && ret=0
           ;;
         (--)
             __git_modified_files
@@ -1887,7 +1971,9 @@ _git-stash () {
           __git_setup_diff_options
 
           _arguments -S -s $endopt \
-            $diff_options \
+            ${diff_options:#*\)-u*} \
+            '(-u --include-untracked --only-untracked)'{-u,--include-untracked}'[show the untracked files in the stash entry as part of the diff]' \
+            '(-u --include-untracked)--only-untracked[show only the untracked files in the stash entry as part of the diff]' \
             ':: :__git_stashes' && ret=0
           ;;
         (pop|apply)
@@ -1909,9 +1995,14 @@ _git-stash () {
             '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
             ':: :__git_stashes' && ret=0
           ;;
+        (store)
+          _arguments -S -s $endopt \
+            '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
+            '(-q --quiet)'{-q,--quiet}'[suppress all output]' && ret=0
+        ;;
         (create)
-          _nothing
-          ;;
+          _message -e messages message
+        ;;
         (*)
           _nothing
           ;;
@@ -1971,7 +2062,8 @@ _git-submodule () {
         init:'initialize a submodule'
         deinit:'unregister a submodule'
         update:'update a submodule'
-	set-branch:'set the default remote tracking branch for the submodule'
+        set-branch:'set default remote tracking branch for the submodule'
+        set-url:'set URL of the specified submodule'
         summary:'show commit summary between given commit and working tree/index'
         foreach:'evaluate shell command in each checked-out submodule'
 	absorbgitdirs:'move the git directory of a submodule into its superprojects'
@@ -2014,7 +2106,6 @@ _git-submodule () {
             '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
           ;;
         (update)
-          # TODO: --init not properly documented.
           _arguments -S \
             '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
             '(-N --no-fetch)'{-N,--no-fetch}'[do not fetch new objects from repository]' \
@@ -2027,6 +2118,8 @@ _git-submodule () {
             '--remote[use the status of the submodule''s remote-tracking branch]' \
             '--force[discard local changes by checking out the current up-to-date version]' \
             '--init[initialize uninitialized submodules]' \
+            '--single-branch[clone only one branch]' \
+            '--filter=[apply partial clone filter to the submodule]:filter' \
             '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
 	;;
 	(set-branch)
@@ -2035,6 +2128,11 @@ _git-submodule () {
 	    '(-b --branch)'{-b,--branch=}'[specify the remote branch]:remote branch' \
 	    '1:path:_directories'
         ;;
+	(set-url)
+          _arguments -C -A '-*' \
+            '1:path:_directories' \
+            '2:url:_urls' && ret=0
+        ;;
         (summary)
           _arguments -C -A '-*' \
             '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
@@ -2093,7 +2191,7 @@ _git-subtree () {
   _arguments -C \
     '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \
     '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \
-    '-d[show debug messages]' \
+    '(-d --debug)'{-d,--debug}'[show debug messages]' \
     ': :->command' \
     '*::: := ->option-or-argument' && ret=0
 
@@ -2190,9 +2288,10 @@ _git-switch() {
     '(-q --quiet --progress)--no-progress[suppress progress reporting]' \
     '--progress[force progress reporting]' \
     '(-m --merge --discard-changes --orphan)'{-m,--merge}'[perform a 3-way merge with the new branch]' \
-    '(--discard-changes --orphan)--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \
+    '(--discard-changes --orphan)--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3 zdiff3)' \
     '(-d --detach -c --create -C --force-create --ignore-other-worktrees --orphan --guess --no-guess 1)'{-d,--detach}'[detach HEAD at named commit]' \
-    '(-t --track --no-track --guess --orphan 1)'{-t,--track}'[set upstream info for new branch]' \
+    '(--track --no-track --guess --orphan 1)-t[set upstream info for new branch]' \
+    '(-t --no-track --guess --orphan 1)--track=-[set upstream info for new branch]::configuration:(direct inherit)' \
     "(-t --track --guess --orphan 1)--no-track[don't set upstream info for a new branch]" \
     '(-c --create -C --force-create -d --detach --ignore-other-worktrees -m --merge --conflict -t --track --guess --no-track -t --track)--orphan[create new unparented branch]: :__git_branch_names' \
     '!--overwrite-ignore' \
@@ -2253,6 +2352,7 @@ _git-tag () {
       "*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \
       '--merged=-[print only tags that are merged]:: :__git_commits' \
       '--no-merged=-[print only tags that are not merged]:: :__git_commits' \
+      "--omit-empty[don't output a newline after empty formatted refs]" \
       '--sort=[specify how the tags should be sorted]:field:__git_ref_sort_keys' \
       '--points-at=[only list tags of the given object]: :__git_commits' \
       '--format=[specify format to use for the output]:format:__git_format_ref' \
@@ -2284,6 +2384,7 @@ _git-worktree() {
 	lock:'prevent a working tree from being pruned'
 	move:'move a working tree to a new location'
 	remove:'remove a working tree'
+        repair:'repair worktree administrative files'
 	unlock:'allow working tree to be pruned, moved or deleted'
       )
 
@@ -2298,23 +2399,34 @@ _git-worktree() {
 	  else
 	    args=( ':commit:__git_commits' )
 	  fi
-          _arguments -S $endopt \
+          _arguments -s -S $endopt \
 	    '(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \
-	    '(-B --detach)-b+[create a new branch]: :__git_branch_names' \
-	    '(-b --detach)-B+[create or reset a branch]: :__git_branch_names' \
-	    '(-b -B)--detach[detach HEAD at named commit]' \
+            '(-B -d --detach --guess-remote)-b+[create a new branch]: :__git_branch_names' \
+            '(-b -d --detach --guess-remote)-B+[create or reset a branch]: :__git_branch_names' \
+            '(-b -d --detach)--orphan[create unborn/orphaned branch]' \
+            '(-d --detach -b -B --orphan --guess-remote --track --no-track)'{-d,--detach}'[detach HEAD at named commit]' \
 	    '--no-checkout[suppress file checkout in new worktree]' \
 	    '--lock[keep working tree locked after creation]' \
+            '--reason=[specify reason for locking]:reason' \
+            '(2 --no-guess-remote -b -B -d --detach)--guess-remote[guess remote tracking branch from path basename]' \
+            "(--guess-remote)--no-guess-remote[don't guess remote tracking branch from path basename]" \
+            '(--no-track -d --detach)--track[set upstream info for new branch]' \
+            "(--track -d --detach)--no-track[don't set upstream info for new branch]" \
+            '(-q --quiet)'{-q,--quiet}'[suppress feedback messages]' \
 	    ':path:_directories' $args && ret=0
 	;;
         (prune)
-          _arguments -S $endopt \
+          _arguments -s -S $endopt \
 	    '(-n --dry-run)'{-n,--dry-run}"[don't remove, show only]" \
 	    '(-v --verbose)'{-v,--verbose}'[report pruned objects]' \
-	    '--expire[expire objects older than specified time]:time' && ret=0
+            '--expire=[expire objects older than specified time]: :_git_approxidates' && ret=0
 	;;
         (list)
-	  _arguments -S $endopt '--porcelain[machine-readable output]' && ret=0
+          _arguments -S $endopt \
+            '(-v --verbose --porcelain -z)'{-v,--verbose}'[output additional information about worktrees]' \
+            "--expire=[add 'prunable' annotation to worktrees older than specified time]: :_git_approxidates" \
+            '(-v)--porcelain[machine-readable output]' \
+            '(-v)-z[terminate each line with a NUL rather than a newline]' && ret=0
 	;;
 	(lock)
 	  _arguments -C -S $endopt '--reason=[specify reason for locking]:reason' ': :->worktrees' && ret=0
@@ -2325,9 +2437,13 @@ _git-worktree() {
             ':location:_directories' && ret=0
 	;;
 	(remove)
-	  _arguments -C -S $endopt '--force[remove working trees that are not clean or that have submodules]' \
+          _arguments -C -S $endopt \
+            '(-f --force)'{-f,--force}'[remove working trees that are not clean or that have submodules]' \
             ': :->worktrees' && ret=0
 	;;
+        (repair)
+          _directories && ret=0
+        ;;
 	(unlock)
 	  state=worktrees
 	;;
@@ -2385,17 +2501,20 @@ _git-config () {
     '(--global --system --local            -f --file --blob)--worktree[use per-worktree config file]' \
     '(--global --system --local --worktree           --blob)'{-f+,--file=}'[use given config file]:config file:_files' \
     '(--global --system --local --worktree -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \
-    '(-t --type --bool --int --bool-or-int --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \
-    '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \
-    '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \
-    '(-t --type --bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \
-    '(-t --type --bool --int --bool-or-int --expiry-date)--path[setting is a path]' \
-    '(-t --type --bool --int --bool-or-int --path)--expiry-date[setting is an expiry date]' \
+    '(-t --type --bool --int --bool-or-int --bool-or-str --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int bool-or-str path expiry-date color)' \
+    '(-t --type --int --bool-or-int --bool-or-str --path --expiry-date)--bool[setting is a boolean]' \
+    '(-t --type --bool --bool-or-int --bool-or-str --path --expiry-date)--int[setting is an integer]' \
+    '(-t --type --bool --int --bool-or-str --path --expiry-date)--bool-or-int[setting is a boolean or integer]' \
+    '(-t --type --bool --int --bool-or-int --path --expiry-date)--bool-or-str[setting is a boolean or string]' \
+    '(-t --type --bool --int --bool-or-int --bool-or-str --expiry-date)--path[setting is a path]' \
+    '(-t --type --bool --int --bool-or-int --bool-or-str --path)--expiry-date[setting is an expiry date]' \
     '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \
+    '--fixed-value[use string equality when comparing values]' \
     '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \
     '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \
     '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \
-    '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \
+    '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-scope)--show-origin[show origin of config]' \
+    '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-origin)--show-scope[show scope of config (worktree, local, global, system, command)]' \
     '(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \
     $name_arg \
     $value_arg \
@@ -2407,14 +2526,14 @@ _git-config () {
       '(--name-only --show-origin)--get-urlmatch[get value specific for the URL]' \
       '(-z --null --name-only --show-origin)--replace-all[replace all values of the given key]' \
       '(3 -z --null --name-only --show-origin)--add[add new value without altering any existing ones]' \
-      '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \
-      '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \
-      '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--rename-section[rename the given section]'  \
-      '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \
-      '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \
-      '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \
-      '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \
-      '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0
+      '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \
+      '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \
+      '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--rename-section[rename the given section]'  \
+      '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \
+      '(: --bool --int --bool-or-int --bool-or-str --path)'{-l,--list}'[list all variables set in config file]' \
+      '(-e --edit --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \
+      '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \
+      '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0
   __git_config_option-or-value "$@" && ret=0
   return ret
 }
@@ -3700,11 +3819,12 @@ _git-fast-export () {
     '--import-marks-if-exists=[load marks from file if it exists]: :_files' \
     '--fake-missing-tagger=[fake a tagger when tags lack them]' \
     '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \
-    '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \
+    "--no-data[skip output of blob objects, instead referring to them via their SHA-1 hash]" \
     '--full-tree[output full tree for each commit]' \
     '(--get --get-all)--name-only[show variable names only]' \
     '*--refspec=[apply refspec to exported refs]:refspec' \
     '--anonymize[anonymize output]' \
+    '*--anonymize-map[apply conversion in anonymized output]:from\:to' \
     '--reference-excluded-parents[reference parents not in fast-export stream by object id]' \
     '--show-original-ids[show original object ids of blobs/commits]' \
     '--mark-tags[label tags with mark ids]' \
@@ -3720,8 +3840,8 @@ _git-fast-import () {
                                                            now\:"use current time and timezone"' \
     '--done[terminate with error if there is no "done" command at the end of the stream]' \
     '--force[force updating modified existing branches]' \
-    '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes' \
-    '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes' \
+    '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes -d unlimited size' \
+    '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes -d 512m size' \
     '--depth=-[maximum delta depth for blob and tree deltification]: :__git_guard_number "maximum delta depth"' \
     '--active-branches=-[maximum number of branches to maintain active at once]: :__git_guard_number "maximum number of branches"' \
     '--export-marks=-[dump internal marks table when complete]: :_files' \
@@ -3777,7 +3897,11 @@ _git-pack-refs () {
     '(      --no-all)--all[pack all refs]' \
     '(--all         )--no-all[do not pack all refs]' \
     '(        --no-prune)--prune[remove loose refs after packing them]' \
-    '(--prune           )--no-prune[do not remove loose refs after packing them]'
+    '(--prune           )--no-prune[do not remove loose refs after packing them]' \
+    '*--include=[references to include]:reference pattern:_git_full_references' \
+    '*--exclude=[references to exclude]:reference pattern:_git_full_references' \
+    '--no-include[clear and reset the list of include patterns]' \
+    '--no-exclude[clear and reset the list of exclude patterns]'
 }
 
 (( $+functions[_git-prune] )) ||
@@ -3786,7 +3910,7 @@ _git-prune () {
     '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \
     '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \
     '--progress[show progress]' \
-    '--expire=[only expire loose objects older than specified date]: :__git_datetimes' \
+    '--expire=[only expire loose objects older than specified date]: :_git_approxidates' \
     '--exclude-promisor-objects[limit traversal to objects outside promisor packfiles]' \
     '*:: :__git_heads'
 }
@@ -3831,21 +3955,19 @@ _git-reflog () {
 
         case $line[1] in
           (expire)
-            # TODO: -n, --dry-run is undocumented.
             _arguments -S \
-              '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
-              '--stale-fix[TODO\: provide a decent description for this option]' \
-              '--expire=-[prune entries older than given time]: :__git_datetimes' \
-              '--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \
+              '(-n --dry-run)'{-n,--dry-run}"[don't actually prune any entries; show what would be pruned]" \
+              '--stale-fix[prune any reflog entries that point to "broken commits"]' \
+              '--expire=-[prune entries older than given time]:age [90 days]:_git_approxidates' \
+              '--expire-unreachable=-[prune entries older than given time and unreachable]:age [30 days]:_git_approxidates' \
               '--all[prune all refs]' \
               '--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
               '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
               '--verbose[output additional information]' && ret=0
             ;;
           (delete)
-            # TODO: -n, --dry-run is undocumented.
             _arguments -C -S \
-              '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
+              '(-n --dry-run)'{-n,--dry-run}"[don't update entries; show what would be done]" \
               '--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
               '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
               '--verbose[output additional information]' \
@@ -3925,7 +4047,9 @@ _git-remote () {
             ': :__git_remotes' && ret=0
           ;;
         (rename)
-          _arguments \
+          _arguments -S $endopt \
+            '(--no-progress)--progress' \
+            '(--progress)--no-progress' \
             ':old name:__git_remotes' \
             ':new name:__git_remotes' && ret=0
           ;;
@@ -3980,12 +4104,13 @@ _git-remote () {
 
 (( $+functions[_git-repack] )) ||
 _git-repack () {
-  # TODO: --quiet is undocumented.
   _arguments -s \
     '(-A --unpack-unreachable)-a[pack all objects into a single pack]' \
     '(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \
+    '--cruft[pack unreachable cruft objects separately]' \
+    '--cruft-expiration=[expire cruft objects older than specified time]: :_git_approxidates' \
     '-d[remove redundant packs after packing]' \
-    "--unpack-unreachable=[with -A, don't loosen objects older than specified date]:date" \
+    "--unpack-unreachable=[with -A, don't loosen objects older than specified date]: :_git_approxidates" \
     '-f[pass --no-reuse-delta option to git pack-objects]' \
     '-F[pass --no-reuse-object option to git pack-objects]' \
     "-n[don't update server information]" \
@@ -3993,7 +4118,7 @@ _git-repack () {
     '(-l --local)'{-l,--local}'[pass --local option to git pack-objects]' \
     '(-b --write-bitmap-index)'{-b,--write-bitmap-index}'[write a bitmap index]' \
     '(-i --delta-islands)'{-i,--delta-islands}'[pass --delta-islands to git-pack-objects]' \
-    "--unpack-unreachable=[with -A, don't loosen objects older than specified time]:time" \
+    "--unpack-unreachable=[with -A, don't loosen objects older than specified time]: :_git_approxidates" \
     '(-k --keep-unreachable)'{-k,--keep-unreachable}'[with -a, repack unreachable objects]' \
     '--window=[number of objects to consider when doing delta compression]:number of objects' \
     '--window-memory=[scale window size dynamically to not use more than specified amount of memory]: : __git_guard_bytes' \
@@ -4001,7 +4126,10 @@ _git-repack () {
     '--threads=[limit maximum number of threads]:threads' \
     '--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \
     '--pack-kept-objects[repack objects in packs marked with .keep]' \
-    '--keep-pack=[ignore named pack]:pack'
+    '--keep-pack=[ignore named pack]:pack' \
+    '(-g --geometric)'{-g+,--geometric=}'[find a geometric progression with specified factor]:factor' \
+    '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]' \
+    '--expire-to=[pack prefix to store a pack containing pruned objects]:directory:_directories'
 }
 
 (( $+functions[_git-replace] )) ||
@@ -4034,7 +4162,7 @@ _git-blame () {
   declare -A opt_args
 
   declare -a revision_options
-  __git_setup_revision_options
+  __git_setup_revision_options -d
 
   # TODO: Not sure about __git_cached_files.
   _arguments -C -S -s $endopt \
@@ -4063,7 +4191,6 @@ _git-blame () {
     '--ignore-revs-file=[ignore revisions from file]:file:_files' \
     '(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \
     '(--color-lines)--color-by-age[color lines by age]' \
-    '--indent-heuristic[use indent-based heuristic to improve diffs]' \
     $revision_options \
     ':: :__git_revisions' \
     ': :__git_cached_files' && ret=0
@@ -4078,7 +4205,8 @@ _git-blame () {
       else
         _alternative \
           'line-numbers: :__git_guard_number "line number"' \
-          'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' && ret=0
+          'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' \
+          'functions::_guard "(|:*)" "function name"' && ret=0
       fi
       ;;
   esac
@@ -4089,16 +4217,16 @@ _git-blame () {
 (( $+functions[_git-bugreport] )) ||
 _git-bugreport() {
   _arguments \
-    '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport file]:directory:_directories' \
-    '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats'
+    '--diagnose=-[create an additional zip archive of detailed diagnostics]::mode [stats]:(stats all)' \
+    '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport]:directory:_directories' \
+    '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format filename suffix]:format:_date_formats'
 }
 
 (( $+functions[_git-cherry] )) ||
 _git-cherry () {
-  # TODO: --abbrev is undocumented.
   _arguments -S $endopt \
     '(-v --verbose)'{-v,--verbose}'[output additional information]' \
-    '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+    '--abbrev=[use specified digits to display object names]:digits' \
     ':upstream commit:__git_commits' \
     '::head commit:__git_commits' \
     '::limit commit:__git_commits'
@@ -4111,6 +4239,14 @@ _git-count-objects () {
     {-H,--human-readable}'[print sizes in human readable format]'
 }
 
+(( $+functions[_git-diagnose] )) ||
+_git-diagnose() {
+  _arguments -S $endopt \
+    '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the diagnostics archive]:destination:_directories' \
+    '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats' \
+    '--mode=[specify the content of the diagnostic archive]:content [stats]:(stats all)'
+}
+
 (( $+functions[_git-difftool] )) ||
 _git-difftool () {
   # TODO: Is this fine, or do we need to modify the context or similar?
@@ -4140,9 +4276,10 @@ _git-fsck () {
     '--full[check all object directories]' \
     '--connectivity-only[check only connectivity]' \
     '--strict[do strict checking]' \
-    '(-v --verbose)'{-v,--verbose}'[output additional information]' \
+    '(-v --verbose --no-progress)'{-v,--verbose}'[output additional information]' \
     '--lost-found[write dangling objects into .git/lost-found]' \
-    '--progress[show progress]' \
+    "(-v --verbose)--no-progress[don't show progress]" \
+    '!(-v --verbose --no-progress)--progress' \
     '--name-objects[show verbose names for reachable objects]' \
     '*: :__git_objects'
 }
@@ -4155,14 +4292,19 @@ _git-get-tar-commit-id () {
 (( $+functions[_git-help] )) ||
 _git-help () {
   _arguments -S -s \
-    '(-c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+    '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+    '(-g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)--no-external-commands[exclude external commands, with --all]' \
+    '(-g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)--no-aliases[exclude aliases, with --all]' \
+    '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
+    '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
+    '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
+    '!(--no-verbose)'{-v,--verbose} \
+    "--no-verbose[don't print command descriptions]" \
+    '(-)'{-g,--guides}'[print list of useful guides]' \
+    '(-)--user-interfaces[print list of user-facing repository, command and file interfaces]' \
+    '(-)--developer-interfaces[print list of file formats, protocols and other developer interfaces]' \
     '(-)'{-c,--config}'[print all configuration variable names]' \
-    '(-a --all -g --guides -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
-    '(-a --all -g --guides -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
-    '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
-    '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
-    '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \
-    ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
+    ': : _alternative commands:command:_git_commands "guides:git guide:_git_help_guides"'
 }
 
 (( $+functions[_git-instaweb] )) ||
@@ -4199,7 +4341,16 @@ _git-instaweb () {
 
 (( $+functions[_git-merge-tree] )) ||
 _git-merge-tree () {
-  _arguments \
+  _arguments -S $endopt \
+    '(1)--write-tree[do a real merge instead of a trivial merge]' \
+    '(-)--trivial-merge[do a trivial merge only]' \
+    '(--no-messages)--messages[also show informational/conflict messages]' \
+    "(--messages)--no-messages[don't show informational/conflict messages]" \
+    '-z[separate paths with the NUL character]' \
+    '--name-only[list filenames without modes/oids/stages]' \
+    '--allow-unrelated-histories[allow merging unrelated histories]' \
+    '--stdin[perform multiple merges, one per line of input]' \
+    '--merge-base=[specify a merge-base for the merge]:commit:__git_commits' \
     ':base-tree:__git_tree_ishs' \
     ':branch 1:__git_tree_ishs' \
     ':branch 2:__git_tree_ishs'
@@ -4210,17 +4361,16 @@ _git-rerere () {
   local curcontext=$curcontext state line ret=1
   declare -A opt_args
 
-  # TODO: --rerere-autoupdate is undocumented.
   _arguments -C -S -s $endopt \
     '--rerere-autoupdate[register clean resolutions in index]' \
-    ': :->command' && ret=0
+    ': :->command' \
+    '*: :{ [[ $words[CURRENT-1] = forget ]] && __git_cached_files }' && ret=0
 
   case $state in
     (command)
-      # TODO: This isn't optimal, as forget get confused.
       _values command \
         'clear[reset metadata used by rerere]' \
-        'forget[resets metadata used by rerere for specific conflict]: :__git_cached_files' \
+        'forget[resets metadata used by rerere for specific conflict]' \
         'diff[output diffs for the current state of the resolution]' \
         'status[print paths with conflicts whose merge resolution rerere will record]' \
         'remaining[print paths with conflicts that have not been autoresolved by rerere]' \
@@ -4296,8 +4446,8 @@ _git-rev-parse () {
       '--is-inside-work-tree[show whether or not current working directory is inside work tree]' \
       '--is-bare-repository[show whether or not repository is bare]' \
       '(--revs-only --no-revs --flags --no-flags --verify)--short=-[show only shorter unique name]:: :__git_guard_number length' \
-      '(--since --after)'{--since=-,--after=-}'[show --max-age= parameter corresponding given date string]:datestring' \
-      '(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]:datestring' \
+      '(--since --after)'{--since=-,--after=-}'[show --max-age= parameter corresponding given date string]: :_git_approxidates' \
+      '(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]: :_git_approxidates' \
       '--resolve-git-dir[check if <path> is a valid repository or gitfile and print location]:git dir:_files -/' \
       '*: :__git_objects' && ret=0
   fi
@@ -4337,7 +4487,7 @@ _git-show-branch () {
       if compset -P '[[:digit:]]##,'; then
         _alternative \
           'counts: :__git_guard_number count' \
-          'dates::__git_datetimes' && ret=0
+          'dates::_git_approxidates' && ret=0
       else
         __git_guard_number limit
       fi
@@ -4499,7 +4649,8 @@ _git-send-email () {
     '--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \
     '--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \
     '--transfer-encoding=[specify transfer encoding to use]:transfer encoding:(quoted-printable 8bit base64)' \
-    '--envelope-sender[specify the envelope sender used to send the emails]: :_email_addresses' \
+    '--envelope-sender=[specify the envelope sender used to send the emails]: :_email_addresses' \
+    '--sendmail-cmd=[specify command to run to send email]:command:_cmdstring' \
     '--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \
     '--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \
     '--smtp-pass=[specify password to use for SMTP-AUTH]::password' \
@@ -4515,6 +4666,8 @@ _git-send-email () {
     '--relogin-delay=[specify delay between successive logins]:delay (seconds)' \
     '--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_cmdstring' \
     '--to-cmd=[specify command to generate To\: header with]:To\: command:_cmdstring' \
+    '--header-cmd=[specify command to generate headers with]:header command:_cmdstring' \
+    '--no-header-cmd[disable any header command in use]' \
     '(                 --no-chain-reply-to)--chain-reply-to[send each email as a reply to previous one]' \
     '(--chain-reply-to                    )--no-chain-reply-to[send all emails after first as replies to first one]' \
     '--identity=[specify configuration identity]: :__git_sendemail_identities' \
@@ -4588,7 +4741,6 @@ _git-svn () {
 
       case $line[1] in
         (clone|dcommit|fetch|init|migrate|rebase|set-tree)
-	  # TODO: --ignore-refs is undocumented.
 	  # TODO: --no-auth-cache is undocumented.
 	  # TODO: --config-dir is undocumented.
 	  opts+=(
@@ -4791,8 +4943,9 @@ _git-svn () {
 	;;
         (rebase)
           opts+=(
-	  '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]"
-	    '(--preserve-merges -p)'{--preserve-merges,-p}'[try to recreate merges instead of ignoring them]'
+            '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]"
+            '!--preserve-merges'
+            '(--rebase-merges -p)'{--rebase-merges,-p}'[try to recreate merges instead of ignoring them]'
 	  )
 	;;
         (reset)
@@ -4842,7 +4995,7 @@ _git-apply () {
 
   _arguments -S -s $endopt \
     $apply_options \
-    '(--index --cached --reject)'{-3,--3way}'[fall back on 3-way merge if patch fails]' \
+    '(--index --cached --reject)'{-3,--3way}'[attempt three-way merge, fall back on normal patch if that fails]' \
     '--stat[output diffstat for input (turns off "apply")]' \
     '--numstat[same as --stat but in decimal notation and complete pathnames (turns off "apply")]' \
     '--summary[output summary of git-diff extended headers (turns off "apply")]' \
@@ -4857,8 +5010,10 @@ _git-apply () {
     '--no-add[ignore additions made by the patch]' \
     '--allow-overlap[allow overlapping hunks]' \
     '--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \
-    '(-v --verbose)'{-v,--verbose}'[display progress on stderr]' \
+    '(-v --verbose -q --quiet)'{-v,--verbose}'[display progress on stderr]' \
+    '(-q --quiet -v --verbose)'{-q,--quiet}'[be more quiet]' \
     '--recount[do not trust line counts in hunk headers]' \
+    "--allow-empty[don't return error for empty patches]" \
     '*:patch:_files'
 }
 
@@ -4875,8 +5030,9 @@ _git-checkout-index () {
     '(-q --quiet)'{-q,--quiet}'[no warning for existing files and files not in index]' \
     '(-f --force)'{-f,--force}'[force overwrite of existing files]' \
     '(-a --all --stdin *)'{-a,--all}'[check out all files in index]' \
-    '(-n --no-create)'{-n,--no-create}'[do not checkout new files]' \
+    '(-n --no-create)'{-n,--no-create}"[don't checkout new files]" \
     '--temp[write content to temporary files]' \
+    "--ignore-skip-worktree-bits[don't skip files with skip-worktree set]" \
     '(-a --all *)--stdin[read list of paths from the standard input]' \
     '--prefix=[prefix to use when creating files]:directory:_directories' \
     '--stage=[check out files from named stage]:stage:(1 2 3 all)' \
@@ -4891,13 +5047,15 @@ _git-commit-graph() {
   if [[ $words[2] = write ]]; then
     args=( $progress
       '(--split --size-multiple --max-commits --expire-time)--append[include all commits present in existing commit-graph file]'
-      '(--append)--split[write the commit-graph as a chain of multiple commit-graph files]'
+      '--changed-paths[enable computation for changed paths]'
+      '(--append)--split=-[write the commit-graph as a chain of multiple commit-graph files]::strategy:(no-merge replace)'
       '(--stdin-packs --stdin-commits)--reachable[walk commits starting at all refs]'
       '(--reachable --stdin-commits)--stdin-packs[only walk objects in pack-indexes read from input]'
       '(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]'
       '(--append)--size-multiple=:commits [2]'
       '(--append)--max-commits=:commits'
-      '(--append)--expire-time=:date/time:__git_datetimes'
+      '(--append)--expire-time=: :_git_approxidates'
+      '--max-new-filters=[specify maximum number of changed-path bloom filters to compute]:'
     )
   elif [[ $words[2] = verify ]]; then
     args=( $progress
@@ -4907,7 +5065,7 @@ _git-commit-graph() {
 
   _arguments -S $endopt $args \
     '--object-dir=[specify location of packfiles and commit-graph file]:directory:_directories' \
-    '(-h)1:verb:(read verify write)'
+    '(-h)1:verb:(verify write)'
 }
 
 (( $+functions[_git-commit-tree] )) ||
@@ -4953,6 +5111,8 @@ _git-index-pack () {
   _arguments \
     '-v[display progress on stderr]' \
     '-o[write generated pack index into specified file]: :_files' \
+    '(--no-rev-index)--rev-index[generate a reverse index corresponding to the given pack]' \
+    "(--rev-index)--no-rev-index[don't generate a reverse index corresponding to the given pack]" \
     '--stdin[read pack from stdin and instead write to specified file]' \
     $stdin_opts \
     '--strict[die if the pack contains broken objects or links]' \
@@ -4973,8 +5133,6 @@ _git-merge-file () {
     label_opt="*-L[label to use for the $ordinals[n_labels+1] file]:label"
   fi
 
-  # TODO: --marker-size in undocumented.
-  # TODO: --diff3 is undocumented.
   _arguments \
     $label_opt \
     '(-p --stdout)'{-p,--stdout}'[send merged file to standard output instead of overwriting first file]' \
@@ -4983,7 +5141,8 @@ _git-merge-file () {
     '(--ours          --union)--theirs[resolve conflicts favoring their side of the lines]' \
     '(--ours --theirs        )--union[resolve conflicts favoring both sides of the lines]' \
     '--marker-size[specify length of conflict markers]: :__git_guard_number "marker length"' \
-    '--diff3[use a diff3 based merge]' \
+    '(--zdiff3)--diff3[show conflicts in "diff3" style]' \
+    '(--diff3)--zdiff3[show conflicts in "zdiff3" style]' \
     ':current file:_files' \
     ':base file:_files' \
     ':other file:_files'
@@ -5023,6 +5182,9 @@ _git-mktree () {
 _git-multi-pack-index() {
   _arguments \
     '--object-dir=[specify location of git objects]:directory:_directories' \
+    '(--progress)--no-progress[turn progress off]' '!(--no-progress)--progress' \
+    '--stdin-packs[write a multi-pack index containing only pack index basenames provided on stdin]' \
+    '--refs-snapshot=[specify a file which contains a "refs snapshot" taken prior to repacking]:file:_files' \
     '--batch-size=[during repack, select packs so as to have pack files of at least the specified size]:size' \
     '1:verb:(write verify expire repack)'
 }
@@ -5052,16 +5214,19 @@ _git-pack-objects () {
     '--delta-base-offset[use delta-base-offset packing]' \
     '--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \
     '--non-empty[only create a package if it contains at least one object]' \
-    '--revs[read revision arguments from standard input]' \
+    '(--stdin-packs)--revs[read revision arguments from standard input]' \
     '(--revs)--unpacked[limit objects to pack to those not already packed]' \
-    '(--revs)--all[include all refs as well as revisions already specified]' \
+    '(--revs --stdin-packs)--all[include all refs as well as revisions already specified]' \
     '--reflog[include objects referred by reflog entries]' \
     '--indexed-objects[include objects referred to by the index]' \
+    '(--revs --all --keep-unreachable --pack-loose-unreachable --unpack-unreachable)--stdin-packs[read packs from stdin]' \
     '(: --max-pack-size)--stdout[output pack to stdout]' \
     '--include-tag[include unasked-for annotated tags if object they reference is included]' \
-    '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \
-    '--pack-loose-unreachable[pack loose unreachable objects]' \
-    '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \
+    '(--revs --stdin-packs --unpack-unreachable)--keep-unreachable[add objects unreachable from refs in packs named with --unpacked to resulting pack]' \
+    '(--revs --stdin-packs)--pack-loose-unreachable[pack unreachable loose objects]' \
+    '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]:: :_git_approxidates' \
+    '--cruft[create a cruft pack]' \
+    '--cruft-expiration=[expire cruft objects older than specified time]: :_git_approxidates' \
     '--sparse[use sparse reachability algorithm]' \
     '--include-tag[include tag objects that refer to objects to be packed]' \
     $thin_opt \
@@ -5076,6 +5241,7 @@ _git-pack-objects () {
     '--missing=[specify how missing objects are handled]:action:(error allow-any allow-promisor print)' \
     "--exclude-promisor-objects[don't pack objects in promisor packfiles]" \
     '--delta-islands[respect islands during delta compression]' \
+    '--uri-protocol=[exclude any configured uploadpack.blobpackfileuri with given protocol]:protocol' \
     ':base-name:_files'
 }
 
@@ -5138,6 +5304,7 @@ _git-symbolic-ref () {
     '(-q --quiet)'{-q,--quiet}'[do not issue error if specified name is not a symbolic ref]' \
     '--short[shorten the ref name (eg. refs/heads/master -> master)]' \
     '-m[update reflog for specified name with specified reason]:reason for update' \
+    '--no-recurse[stop after dereferencing a single level of symbolic ref]' \
     ':symbolic reference:__git_heads' \
     ':: :__git_references'
 }
@@ -5176,6 +5343,7 @@ _git-update-index () {
     '(-q --unmerged --ignore-missing --refresh)--really-refresh[refresh index, unconditionally checking stat information]' \
     '(                --no-skip-worktree)--skip-worktree[set "skip-worktree" bit for given paths]' \
     '(--skip-worktree                   )--no-skip-worktree[unset "skip-worktree" bit for given paths]' \
+    "--ignore-skip-worktree-entries[don't touch index-only entries]" \
     '(-)'{-g,--again}'[run git-update-index on differing index entries]' \
     '(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \
     '--info-only[only insert files object-IDs into index]' \
@@ -5232,8 +5400,8 @@ _git-cat-file () {
   _arguments -S -s \
     '(-t -s -e -p --allow-unknown-type 1)--textconv[show content as transformed by a textconv filter]' \
     '(-t -s -e -p --allow-unknown-type 1)--filters[show content as transformed by filters]' \
-    '(-t -s -e -p --allow-unknown-type 1)--path=[use a specific path for --textconv/--filters]:path:_directories' \
     - query \
+    '(-t -s -e -p --allow-unknown-type 1)--path=[use a specific path for --textconv/--filters]:path:_directories' \
     '(-s -e -p --textconv --filters 1)-t[show type of given object]' \
     '(-t -e -p --textconv --filters 1)-s[show size of given object]' \
     '(-e -p --textconv --filters 1)--allow-unknown-type[allow query of broken/corrupt objects of unknown type]' \
@@ -5242,12 +5410,14 @@ _git-cat-file () {
     '(-):object type:(blob commit tag tree)' \
     ': :__git_objects' \
     - batch \
-    '(--batch-check)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \
-    '(--batch)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \
+    '(--batch-check --batch-command)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \
+    '(--batch --batch-command)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \
+    '(--batch-check --batch)--batch-command=-[enter a command mode that reads commands and arguments from stdin]::format' \
     '--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \
     '--batch-all-objects[show all objects with --batch or --batch-check]' \
     "--unordered[don't order --batch-all-objects output]" \
-    '--buffer[disable flushing of output after each object]'
+    '--buffer[disable flushing of output after each object]' \
+    '-Z[input and output is NUL-delimited instead of newline-delimited]'
 }
 
 (( $+functions[_git-diff-files] )) ||
@@ -5275,8 +5445,11 @@ _git-diff-index () {
   # to given tree-ish?  This should be done for git-diff as well, in that case.
   _arguments -S \
     $revision_options \
+    '--exit-code[report exit code 1 if differences, 0 otherwise]' \
+    '(--exit-code)--quiet[disable all output]' \
     "--cached[don't consider the work tree at all]" \
     '-m[flag non-checked-out files as up-to-date]' \
+    '--merge-base[use merge base instead of comparing directly]' \
     ': :__git_tree_ishs' \
     '*: :__git_cached_files'
 }
@@ -5293,16 +5466,18 @@ _git-diff-tree () {
   # __git_setup_revision_options, but only used by this command, so only have
   # them here.
   _arguments -C -S -s \
-    $revision_options \
+    ${revision_options:#*--cc\[*} \
+    '--exit-code[report exit code 1 if differences, 0 otherwise]' \
+    '(--exit-code)--quiet[disable all output]' \
     '-r[recurse into subdirectories]' \
     '(-r   )-t[display tree objects in diff output]' \
     '--root[display root diff]' \
+    '--merge-base[use merge base instead of comparing directly]' \
     '-m[do not ignore merges]' \
     '-s[do not show differences]' \
     '(--pretty --header)-v[display commit message before differences]' \
     '--no-commit-id[do not display commit IDs]' \
-    '(-c --cc)-c[show differences from each of parents to merge result]' \
-    '(-c --cc)--cc[how differences from each of parents and omit differences from only one parent]' \
+    '(-c)--cc[combined diff format for merge commits, further omitting uninteresting hunks]' \
     '--combined-all-paths[show name of file in all parents for combined diffs]' \
     '--always[always show commit itself and commit log message]' \
     ': :__git_tree_ishs' \
@@ -5339,21 +5514,24 @@ _git-for-each-ref () {
   # is, %(refname), %(objecttype), %(objectsize), %(objectname) with optional '*'
   # in front.
   _arguments -S -s \
+    "--omit-empty[don't output a newline after empty formatted refs]" \
     '--count=[maximum number of refs to iterate over]: :__git_guard_number "maximum number of refs"' \
     '*--sort=[key to sort refs by]: :__git_ref_sort_keys' \
     '--format=-[output format of ref information]:format:__git_format_ref' \
     '--color=-[respect any colors specified in the format]::when:(always never auto)' \
+    '--exclude=[exclude refs which match pattern]:pattern:_git_full_references' \
     '*--points-at=[print only refs which point at the given object]:object:__git_commits' \
     '*--merged=[print only refs that are merged]:object:__git_commits' \
     '*--no-merged=[print only refs that are not merged]:object:__git_commits' \
     '*--contains=[print only refs that contain specified commit]:object:__git_commits' \
     "*--no-contains=[print only refs that don't contain specified commit]:object:__git_commits" \
     '--ignore-case[sorting and filtering are case-insensitive]' \
+    '(1)--stdin[read reference patterns from stdin]' \
     '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \
     '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \
     '(-s --shell -p --perl          --tcl)'--python'[use string literals suitable for Python]' \
     '(-s --shell -p --perl --python      )'--tcl'[use string literals suitable for Tcl]' \
-    ':: :_guard "([^-]?#|)" pattern'
+    ':: :_git_full_references'
 }
 
 (( $+functions[_git-for-each-repo] )) ||
@@ -5372,22 +5550,22 @@ _git-ls-files () {
     no_empty_directory_opt="--no-empty-directory[don't list empty directories]"
   fi
 
-  # TODO: --resolve-undo is undocumented.
   # TODO: Replace _files with something more intelligent based on seen options.
   # TODO: Apply excludes like we do for git-clean.
   _arguments -S -s $endopt \
     '(-c --cached)'{-c,--cached}'[show cached files in output]' \
     '(-d --deleted)'{-d,--deleted}'[show deleted files in output]' \
     '(-m --modified)'{-m,--modified}'[show modified files in output]' \
-    '(-o --others)'{-o,--others}'[show other files in output]' \
+    '(-o --others --format)'{-o,--others}'[show other files in output]' \
     '(-i --ignored)'{-i,--ignored}'[show ignored files in output]' \
-    '(-s --stage --with-tree)'{-s,--stage}'[show stage files in output]' \
+    '(-s --stage --with-tree --format)'{-s,--stage}'[show stage files in output]' \
     '--directory[if a whole directory is classified as "other", show just its name]' \
-    '--eol[show line endings of files]' \
+    '(--format)--eol[show line endings of files]' \
     $no_empty_directory_opt \
     '(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \
-    '(-k --killed)'{-k,--killed}'[show killed files in output]' \
-    '-z[use NUL termination on output]' \
+    '(--format)--resolve-undo[show resolve-undo information]' \
+    '(-k --killed --format)'{-k,--killed}'[show killed files in output]' \
+    '-z[separate paths with the NUL character]' \
     '*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \
     '*'{-X,--exclude-from=-}'[skip files matching patterns in given file]: :_files' \
     '*--exclude-per-directory=-[skip directories matching patterns in given file]: :_files' \
@@ -5398,8 +5576,11 @@ _git-ls-files () {
     '(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \
     '--full-name[force paths to be output relative to the project top directory]' \
     '--recurse-submodules[recurse through submodules]' \
-    '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+    '--abbrev=[use specified digits to display object names]:digits' \
     '--debug[show debugging data]' \
+    '--deduplicate[suppress duplicate entries]' \
+    '--sparse[show sparse directories in the presence of a sparse index]' \
+    '(-s --stage -o --others -k --killed --resolve-undo --eol)--format=[specify format to use for the output]:format' \
     '*:: :_files'
 }
 
@@ -5430,10 +5611,12 @@ _git-ls-tree () {
     '(-t)-d[do not show children of given tree (implies -t)]' \
     '-r[recurse into subdirectories]' \
     '-t[show tree entries even when going to recurse them]' \
-    '(-l --long)'{-l,--long}'[show object size of blob entries]' \
+    '(-l --long --name-only --name-status --format)'{-l,--long}'[show object size of blob entries]' \
     '-z[use NUL termination on output]' \
-    '(--name-only --name-status)'{--name-only,--name-status}'[list only filenames, one per line]' \
-    '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+    '(--name-only --name-status -l --long --object-only --format --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \
+    '(--name-only --name-status --format)--object-only[list only objects]' \
+    '(--name-only --name-status -l --long --object-only)--format=[specify format to use for the output]:format' \
+    '(--name-only --name-status)--abbrev=[use specified digits to display object names]:digits' \
     '--full-name[output full path-names]' \
     '(--full-name)--full-tree[do not limit listing to current working-directory]' \
     ': :__git_tree_ishs' \
@@ -5467,12 +5650,13 @@ _git-name-rev () {
     '*--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \
     '--no-refs[clear any previous ref patterns given]' \
     '*--exclude=[ignore refs matching specified pattern]:pattern' \
-    '(--stdin :)--all[list all commits reachable from all refs]' \
-    '(--all :)--stdin[read from stdin and append revision-name]' \
+    '(--annotate-stdin :)--all[list all commits reachable from all refs]' \
+    '(--all :)--annotate-stdin[annotate text from stdin]' \
+    '!(--all : --annotate-stdin)--stdin' \
     '--name-only[display only name of commits]' \
     '--no-undefined[die with non-zero return when a reference is undefined]' \
     '--always[show uniquely abbreviated commit object as fallback]' \
-    '(--stdin --all)*: :__git_commits'
+    '(--annotate-stdin --all)*: :__git_commits'
 }
 
 (( $+functions[_git-pack-redundant] )) ||
@@ -5490,7 +5674,7 @@ _git-rev-list () {
   declare -A opt_args
 
   declare -a revision_options
-  __git_setup_revision_options
+  __git_setup_revision_options -d
 
   _arguments -C -S $endopt \
     $revision_options \
@@ -5505,6 +5689,8 @@ _git-rev-list () {
     "--no-object-names[don't print the names of the object IDs that are found]" \
     '!(--no-object-names)--object-names)' \
     '--timestamp[print raw commit timestamp]' \
+    "*--exclude-hidden=[don't include refs that would be hidden by git-receive-pack or git-upload-pack]:value:(fetch receive uploadpack)" \
+    '--disk-usage=-[print space used for storage by the selected commits or objects]::value:(human)' \
     '(         --bisect-vars --bisect-all)--bisect[show only middlemost commit object]' \
     '(--bisect)--bisect-vars[same as --bisect, displaying shell-evalable code]' \
     '(--bisect)--bisect-all[display all commit objects between included and excluded commits]' \
@@ -5536,8 +5722,9 @@ _git_rev-list_filters() {
 }
 
 (( $+functions[_git-show-index] )) ||
-_git-show-index () {
-  _message 'no arguments allowed; accepts index file on standard input'
+_git-show-index() {
+  _arguments \
+    '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)'
 }
 
 (( $+functions[_git-show-ref] )) ||
@@ -5550,7 +5737,7 @@ _git-show-ref () {
       '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \
       '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \
       '--verify[enable stricter reference checking]' \
-      '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+      '--abbrev=[use specified digits to display object names]:digits' \
       '(-q --quiet)'{-q,--quiet}'[do not print any results]' \
       '*: :_guard "([^-]?#|)" pattern' \
     - exclude \
@@ -5579,6 +5766,7 @@ _git-verify-pack () {
   _arguments -S -s $endopt \
     '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \
     '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \
+    '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
     '*:index file:_files -g "*.idx(-.)"'
 }
 
@@ -5657,14 +5845,14 @@ _git-send-pack () {
     '(-q --quiet)'{-q,--quiet}'[be more quiet]' \
     '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \
     '--remote[specify remote name]:remote' \
-    '--all[update all refs that exist locally]' \
+    '(*)--all[update all refs that exist locally]' \
     '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \
     '--mirror[mirror all refs]' \
     '(-f --force)'{-f,--force}'[update remote orphaned refs]' \
     "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \
     '(--no-signed --sign)--signed[GPG sign the push]' \
     "(--sign --signed)--no-signed[don't GPG sign the push]" \
-    '--push-option=[specify option to transmit]:option' \
+    '*--push-option=[specify option to transmit]:option' \
     '--progress[force progress reporting]' \
     '--thin[send a thin pack]' \
     '--atomic[request atomic transaction on remote side]' \
@@ -5672,6 +5860,7 @@ _git-send-pack () {
     '--stdin[read refs from stdin]' \
     '--helper-status[print status from remote helper]' \
     '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \
+    '--force-if-includes[require remote updates to be integrated locally]' \
     ': :__git_any_repositories' \
     '*: :__git_remote_references'
 }
@@ -5691,8 +5880,10 @@ _git-http-fetch () {
     '-v[report what is downloaded]' \
     '-w[write commit-id into the filename under "$GIT_DIR/refs/<filename>"]:filename' \
     '--recover[recover from a failed fetch]' \
-    '(1)--stdin[read commit ids and refs from standard input]' \
-    ': :__git_commits' \
+    '(1 --packfile)--stdin[read commit ids and refs from standard input]' \
+    '!(1 --stdin)--packfile=:hash' \
+    '!--index-pack-args=:args' \
+    '1: :__git_commits' \
     ': :_urls'
 }
 
@@ -5713,12 +5904,9 @@ _git-http-push () {
 
 (( $+functions[_git-receive-pack] )) ||
 _git-receive-pack () {
-  # TODO: --advertise-refs is undocumented.
-  # TODO: --stateless-rpc is undocumented.
   _arguments -S -A '-*' $endopt \
     '(-q --quiet)'{-q,--quiet}'[be quiet]' \
-    '--advertise-refs[undocumented]' \
-    '--stateless-rpc[undocumented]' \
+    '--stateless-rpc[quit after a single request/response exchange]' \
     ':directory to sync into:_directories'
 }
 
@@ -5787,46 +5975,51 @@ _git-upload-pack () {
 
 (( $+functions[_git-check-attr] )) ||
 _git-check-attr () {
-  local z_opt=
-
-  local curcontext=$curcontext state line ret=1
+  local curcontext="$curcontext" z_opt ret=1
+  local -a state line
   declare -A opt_args
 
   if (( words[(I)--stdin] )); then
-    z_opt='-z[paths are separated with NUL character when reading from stdin]'
+    z_opt='-z[terminate input file list and output records by a NUL character]'
+  else
+    z_opt='-z[separate output records with NUL character]'
   fi
 
-  _arguments -C \
-    {-a,--all}'[list all attributes that are associated with the specified paths]' \
+  _arguments -C $z_opt \
     '--stdin[read file names from stdin instead of from command line]' \
-    '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \
-    '-z[terminate input and output records by a NUL character]' \
-    $z_opt \
+    '(--source)--cached[consider .gitattributes in the index only, ignoring the working tree]' \
+    '(--cached)--source=[specify tree to scan for .gitattributes (useful in bare repo)]:tree object:__git_tree_ishs' \
+    - files \
+    '(-a --all --)'{-a,--all}'[list all attributes that are associated with the specified paths]' \
     '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
-    '*:: :->attribute-or-file' && ret=0
+    '*: :__git_cached_files' \
+    - attrs \
+    '*:::attribute:->attributes' && ret=0
 
   case $state in
-    (attribute-or-file)
-      local -a attributes
-
-      attributes=(crlf ident filter diff merge)
-
-      local only_attributes=1
-      for (( i = 2; i < $#words; i++ )); do
-        if (( attributes[(I)$words[i]] == 0 )); then
-          only_attributes=0
-          break
-        fi
-      done
-
-      if (( !only_attributes )) || [[ -n ${opt_args[(I)--]} ]]; then
-        __git_cached_files && ret=0
-      else
-        _alternative \
-          'attributes::__git_attributes' \
-          'files::__git_cached_files' && ret=0
-      fi
-      ;;
+    attributes)
+      local -a attributes plain dedup
+      attributes=(
+        crlf:"line-ending convention (deprecated)"
+        text:"line-ending normalization"
+        eol:"line-ending style"
+        working-tree-encoding:"text encoding in working directory"
+        ident:'$Id$ substitution'
+        filter:"filters"
+        diff:"textual diff"
+        merge:"merging strategy"
+        conflict-marker-size:"length of markers left in the work tree"
+        whitespace:"control over what diff and apply should consider whitespace errors"
+        export-ignore:"exclude from archive files"
+        export-subst:"expand placeholders when adding to an archive"
+        delta:"don't attempt compression of blobs"
+        encoding:"character encoding that should be used by GUI tools"
+      )
+      plain=( ${attributes%%:*} )
+      dedup=( "${(@)words[1,CURRENT-1]}" )
+      (( ! ${#dedup:|plain} )) && _describe -t git-attributes \
+          attribute attributes -F dedup && ret=0
+    ;;
   esac
 
   return ret
@@ -5850,9 +6043,28 @@ _git-fmt-merge-msg () {
     '(      --no-log)--log=-[display one-line descriptions from actual commits being merged]::number of commits [20]' \
     '(--log         )--no-log[do not display one-line descriptions from actual commits being merged]' \
     '(-m --message)'{-m+,--message=}'[use given message instead of branch names for first line in log message]:message' \
-    '(-F --file)'{-F,--file}'[specify list of merged objects from file]: :_files'
+    '--into-name=[specify substitute name for the real target branch to use]:name' \
+    '(-F --file)'{-F+,--file=}'[specify list of merged objects from file]: :_files'
+}
+
+(( $+functions[_git-hook] )) ||
+_git-hook() {
+  local -a args
+  local gitdir=$(_call_program gitdir git rev-parse --git-dir)
+  [[ -f $gitdir/gitdir ]] && gitdir=$(<$gitdir/gitdir) # needed in worktrees
+
+  (( ${(M)#words[1,CURRENT-1]:#[^-]*} >= 3 )) && args=(
+    {--,--end-of-options}'[end options to git hook, allowing options to the hook itself]'
+  )
+  [[ -n ${(M)words[1,CURRENT-1]:#--(|end-of-options)} ]] && args=( '*:: :_default' )
+  _arguments $args \
+    '--ignore-missing[ignore any missing hook by quietly returning zero]' \
+    "--to-stdin=[specify file which will be redirected to hook's stdin]:file:_files" \
+    '1:subcommand:(run)' \
+    '2:hook name:compadd $gitdir/hooks/*(x\:t)'
 }
 
+
 (( $+functions[_git-mailinfo] )) ||
 _git-mailinfo () {
   # TODO: --no-inbody-headers is undocumented.
@@ -5863,8 +6075,10 @@ _git-mailinfo () {
     '(-u --encoding)--encoding=-[encode commit information in given encoding]: :__git_encodings' \
     '-n[disable all charset re-coding of metadata]' \
     '(-m --message-id)'{-m,--message-id}'[copy the Message-ID header at the end of the commit message]' \
+    '-n[disable charset re-coding of metadata]' \
     '(           --no-scissors)--scissors[remove everything in body before a scissors line]' \
     '(--scissors              )--no-scissors[do not remove everything in body before a scissors line]' \
+    '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \
     '--no-inbody-headers[undocumented]' \
     ':message file:_files' \
     ':patch file:_files'
@@ -5890,7 +6104,8 @@ _git-merge-one-file () {
 _git-patch-id () {
    _arguments \
      '--stable[use a sum of hashes unaffected by diff ordering]' \
-     '--unstable[use patch-id compatible with git 1.9 and older]'
+     '--unstable[use patch-id compatible with git 1.9 and older]' \
+     "--verbatim[don't strip whitespace from the patch]"
 }
 
 # NOTE: git-sh-setup isn't a user command.
@@ -6105,6 +6320,7 @@ _git_commands () {
     blame:'show what revision and author last modified each line of a file'
     bugreport:'collect information for user to file a bug report'
     count-objects:'count unpacked objects and display their disk consumption'
+    diagnose:'generate an archive of diagnostic information'
     difftool:'show changes using common diff tools'
     fsck:'verify connectivity and validity of objects in database'
     help:'display help information about git'
@@ -6134,7 +6350,7 @@ _git_commands () {
     checkout-index:'copy files from index to working directory'
     commit-graph:'write and verify Git commit-graph files'
     commit-tree:'create new commit object'
-    hash-object:'compute object ID and optionally create a blob from a file'
+    hash-object:'compute object ID and optionally create an object from a file'
     index-pack:'build pack index file for an existing packed archive'
     merge-file:'run a three-way file merge'
     merge-index:'run merge for files needing merging'
@@ -6196,6 +6412,7 @@ _git_commands () {
     check-ref-format:'ensure that a reference name is well formed'
     column:'display data in columns'
     fmt-merge-msg:'produce merge commit message'
+    hook:'run git hooks'
     mailinfo:'extract patch and authorship from a single email message'
     mailsplit:'split mbox file into a list of files'
     merge-one-file:'standard helper-program to use with git merge-index'
@@ -6205,8 +6422,8 @@ _git_commands () {
   zstyle -a :completion:$curcontext: user-commands user_commands
 
   local command
-  for command in $_git_third_party_commands; do
-    (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command
+  for command in ${(k)_git_third_party_commands}; do
+    (( $+commands[git-${command}] )) && third_party_commands+=$command$_git_third_party_commands[$command]
   done
 
   local -a aliases
@@ -6239,6 +6456,18 @@ _git_commands () {
   _alternative $alts
 }
 
+(( $+functions[_git_help_guides] )) ||
+_git_help_guides() {
+  local -a guides userint devint
+  guides=( ${${${(M)${(f)"$(_call_program git-guides git help -g)"}:# *}## #}/ ##/:} )
+  userint=( ${${${(M)${(f)"$(_call_program git-guides git help --user-interfaces)"}:# *}## #}/ ##/:} )
+  devint=( ${${${(M)${(f)"$(_call_program git-guides git help --developer-interfaces)"}:# *}## #}/ ##/:} )
+  _alternative \
+    'git-guides: : _describe -t git-guides guide guides' \
+    'user-interfaces: : _describe -t user-interfaces "user interface" userint' \
+    'developer-interfaces: : _describe -t developer-interfaces "developer interfaces" devint'
+}
+
 (( $+functions[__git_aliases] )) ||
 __git_aliases () {
   local -a aliases
@@ -6276,7 +6505,7 @@ __git_date_formats () {
   declare -a date_formats
 
   if compset -P 'format(-local|):'; then
-    _strftime
+    _date_formats
     return
   fi
 
@@ -6366,6 +6595,16 @@ __git_merge_strategies () {
       "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree}
 }
 
+(( $+functions[_git_strategy_options] )) ||
+_git_strategy_options() {
+  _values "strategy option" ours theirs ignore-space-change \
+    ignore-all-space ignore-space-at-eol ignore-cr-at-eol \
+    renormalize no-renormalize \
+    'find-renames::similarity threshold' \
+    subtree:path \
+    'diff-algorithm:algorithm:(patience minimal histogram myers)'
+}
+
 (( $+functions[__git_encodings] )) ||
 __git_encodings () {
   # TODO: Use better algorithm, as shown in iconv completer (separate it to a
@@ -6493,20 +6732,6 @@ __git_compression_levels () {
     '9:maximum compression'
 }
 
-(( $+functions[__git_attributes] )) ||
-__git_attributes () {
-  local -a attributes
-
-  attributes=(
-    'crlf:line-ending convention'
-    'ident:ident substitution'
-    'filter:filters'
-    'diff:textual diff'
-    'merge:merging strategy')
-
-  _describe -t attributes attribute attributes $*
-}
-
 (( $+functions[__git_daemon_service] )) ||
 __git_daemon_service () {
   local -a services
@@ -6518,6 +6743,31 @@ __git_daemon_service () {
   _describe -t services service services $*
 }
 
+(( $+functions[_git_log_line_ranges] )) ||
+_git_log_line_ranges() {
+  local sep pos=start op=( / : )
+  if compset -P '*[^,^]:'; then
+    __git_tree_files ${PREFIX:-.} HEAD
+  else
+    compset -P 1 '*,' && pos=end
+    if compset -P '(^|):'; then
+      _message -e functions function
+    elif compset -P '(^|)/'; then
+      _message -e patterns regex
+    else
+      zstyle -s ":completion:${curcontext}:forms" list-separator sep || sep=--
+      sep=' -- '
+      sep="${(q)sep}"
+      _guard "[0-9]#" "$pos line number" && return
+      compset -P \^ || op+=( \^ )
+      _wanted forms expl form compadd -S '' -d "(
+        /\ $sep\ regex
+        :\ $sep\ function
+        ^\ $sep\ search\ from\ start\ of\ file )" $op
+    fi
+  fi
+}
+
 (( $+functions[__git_log_decorate_formats] )) ||
 __git_log_decorate_formats () {
   declare -a log_decorate_formats
@@ -6897,7 +7147,6 @@ __git_heads_remote () {
 
 (( $+functions[__git_commit_objects] )) ||
 __git_commit_objects () {
-  local gitdir expl start
   declare -a commits
 
   if [[ -n $PREFIX[(r)@] ]] || [[ -n $SUFFIX[(r)@] ]]; then
@@ -6919,7 +7168,7 @@ __git_commit_objects () {
 
 (( $+functions[__git_recent_commits] )) ||
 __git_recent_commits () {
-  local gitdir expl start
+  local expl
   declare -a descr tags heads commits argument_array_names commit_opts
   local h i j k ret
   integer distance_from_head
@@ -7004,6 +7253,16 @@ __git_recent_commits () {
   return ret
 }
 
+(( $+functions[_git_fixup] )) ||
+_git_fixup() {
+  local alts
+  alts=( 'commits: :__git_recent_commits' )
+  if ! compset -P '(amend|reword):'; then
+    alts+=( 'actions:action:compadd -S: amend reword' )
+  fi
+  _alternative $alts
+}
+
 (( $+functions[__git_blob_objects] )) ||
 __git_blob_objects () {
   _guard '[[:xdigit:]](#c,40)' 'blob object name'
@@ -7193,6 +7452,16 @@ __git_remote_references () {
   __git_references
 }
 
+(( $+functions[_git_full_references] )) ||
+_git_full_references() {
+
+  if [[ $_git_full_refs_cache_pwd != $PWD ]]; then
+    _git_full_refs_cache=( ${(f)"$(_call_program references 'git for-each-ref --format=%\(refname\)')"} )
+    _git_full_refs_cache_pwd=$PWD
+  fi
+  _multi_parts "$@" / _git_full_refs_cache
+}
+
 (( $+functions[__git_notes_refs] )) ||
 __git_notes_refs () {
   local expl
@@ -7288,6 +7557,19 @@ __git_deleted_files () {
   __git_files --deleted deleted-files 'deleted file' $*
 }
 
+(( $+functions[__git_trailers_tokens] )) ||
+__git_trailers_tokens() {
+  declare -a trailers
+  local i
+
+  local -a gtrailers=( $(_call_program trailers git config --name-only --get-regexp '^trailer\..*\.key$') )
+  for i in $gtrailers; do
+    i=( ${${(@s:.:)i}[2,-2]} )
+    trailers+=( ${(j|.|)i} )
+  done
+  _wanted trailers expl "trailer" compadd -a trailers
+}
+
 (( $+functions[__git_modified_files] )) ||
 __git_modified_files () {
   __git_files --modified modified-files 'modified file' $*
@@ -7506,13 +7788,68 @@ __git_guard_number () {
 
 (( $+functions[__git_guard_bytes] )) ||
 __git_guard_bytes () {
-  _guard '[[:digit:]]#([kKmMgG]|)' ${*:-size}
+  _numbers -u bytes ${*:-size} k m g
 }
 
-(( $+functions[__git_datetimes] )) ||
-__git_datetimes () {
-  # TODO: Use this in more places.
-  _guard '*' 'time specification'
+(( $+functions[_git_approxidates] )) ||
+_git_approxidates() {
+  local MATCH MBEGIN MEND
+  local match mbegin mend
+  local -i date time num
+  local -a months=( January February March April May June July August September
+      October November December )
+  local -a weekdays=( Sunday Monday Tuesday Wednesday Thursday Friday Saturday )
+  local -a numbers=( zero one two three four five six seven eight nine ten )
+  local -a periods=( second minute hour day week month year )
+  local -a suf=( -S. -r "._,+\\ \t\n\-" )
+
+  local -a pexpl
+  zparseopts -D -E X+:=pexpl
+
+  local -a query=(
+    \( /$'*\0[ \t\n]#'/ \)
+    \( '/[]/' ':dates:date:compadd "${pexpl[@]:/-X/-x}"'
+    \| '/(@|[0-9](#c9))/' ':specials:special:compadd -S "" @' '/[]/' ': _message -e epochtimes "seconds since Unix epoch"'
+    \| '/(#i)(now|never)/' '%?%' ':specials:special:(now never)' '/[]/'
+    \| \)
+    \(
+      \( '/(#i)(one|last)/' '%[ ._,+]%' -'num=1'
+      \| '/[0-9](#c2,4)(-|/|.|)[0-9](#c1,2)(-|/|.|)[0-9](#c1,4)(|T)/' -'date=3'
+      \| '/[0-9](#c2)(:|)[0-9](#c2)(:|)[0-9](#c2)(.<->|)/' -'time=1'
+      \| '/20/' -'((!date))' '/[]/' ':dates:date:_dates -f "%y-%m-%d"'
+      \| '/1/' -'num=1'
+      \| '/<->/' -'num=2'
+      \| "/(#i)(${(j.|.)numbers})/" '%[ ._,+]%' -'num=2'
+      \| "/(#i)(${(j.|.)${(@)months//(#b)(???)(*)/$match[1]${match[2]//(#m)?/(|$MATCH}${match[2]//?/)}}})/"
+         '%[ ._,+]%' -'(( num = 0, date |= 2 ))'
+      \| "/(#i)(${(j.|.)${(@)weekdays//(#b)(???)(*)/$match[1]${match[2]//(#m)?/(|$MATCH}${match[2]//?/)}}})(|s)/"
+         '%[ ._,+]%' -'(( num = 0, date |= 1 ))'
+      \| '/(#i)yesterday/' '%[ ._,+]%' -'date=3'
+      \| "/(#i)(${(j.|.)${(@)periods%s}})(|s)/" '%[ ._,+]%' -'num=0'
+      \| '/(#i)(noon|midnight|tea|[ap]m)/' '%[ ._,+]%' -'time=1'
+      \|
+        \( // -'(( !(date&2) ))' // ':months:month:compadd -o nosort $suf -a months' \| \)
+        \( // -'(( num <= 1 && !(date&1) ))' // ':weekdays:weekday:compadd $suf -o nosort -a weekdays' \| \)
+        \( // -'(( num > 1 ))'
+          \( // -'(( date < 3 ))' // ':periods:period:compadd $suf -o nosort ${^periods[4,-1]}s' \| \)
+          \( // -'(( !(date&1) ))' // ':weekdays:weekday:compadd $suf -o nosort ${^weekdays}s' \| \)
+          \( // -'(( !time ))' // ':periods:period:compadd $suf -o nosort ${^periods[1,3]}s' \| \)
+        \| // -'(( num == 1 ))'
+          \( // -'(( date < 3 ))' // ':periods:period:compadd $suf -o nosort -a "periods[4,-1]"' \| \)
+          \( // -'(( !time ))' // ':periods:period:compadd $suf -o nosort -a "periods[1,3]"' \| \)
+        \| // -'(( num == 0 ))'
+          \( // -'(( !time ))' // ':specials:special:compadd $suf noon midnight tea AM PM' \| \)
+          \( // -'(( !date ))' // ':specials:special:compadd $suf yesterday' \| \)
+          // ':specials:special:compadd $suf last' # "last" is equivalent to "one"
+          // ':numbers:number:compadd $suf -n -o nosort -a numbers'
+        \)
+        '/[]/'
+      \) '/([ ._,+]|)/'
+    \) \#
+  )
+
+  _regex_arguments _git_dates "$query[@]"
+  _git_dates
 }
 
 (( $+functions[__git_stages] )) ||
@@ -7532,6 +7869,7 @@ __git_setup_log_options () {
   # TODO: Need to implement -<n> for limiting the number of commits to show.
   log_options=(
     '(- *)-h[display help]'
+    '--clear-decorations[clear all previously-defined decoration filters]'
     '--decorate-refs=[only decorate refs that match pattern]:pattern'
     "--decorate-refs-exclude=[don't decorate refs that match pattern]:pattern"
     '(           --no-decorate)--decorate=-[print out ref names of any commits that are shown]: :__git_log_decorate_formats'
@@ -7539,7 +7877,7 @@ __git_setup_log_options () {
     '(          --no-follow)--follow[follow renames]'
     '(--follow             )--no-follow[do not follow renames]'
     '--source[show which ref each commit is reached from]'
-    '-L+[trace the evolution of a line range or regex within a file]:range'
+    '*-L+[trace evolution of line range, function or regex within a file]: :_git_log_line_ranges'
   )
 }
 
@@ -7572,8 +7910,9 @@ __git_setup_diff_options () {
   local exclusive_diff_options='(--name-only --name-status --check -s --no-patch)'
 
   diff_options=(
-    {-p,-u,--patch}'[generate diff in patch format]'
-    {-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines'
+    '(-p -u --patch)'{-p,-u,--patch}'[generate diff in patch format]'
+    '(-U --unified -W --function-context)'{-U-,--unified=-}'[generate diff with given lines of context]:: :__git_guard_number lines'
+    '(-U --unified -W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \
     '--raw[generate default raw diff output]'
     '--patch-with-raw[generate patch but also keep the default raw diff output]'
     $exclusive_diff_options{-s,--no-patch}'[suppress diff output]'
@@ -7622,7 +7961,7 @@ __git_setup_diff_options () {
     '--full-index[show full object name of pre- and post-image blob]'
     '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]'
     '--ws-error-highlight=[specify where to highlight whitespace errors]: :__git_ws_error_highlight'
-    '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length'
+    '--abbrev=[use specified digits to display object names]:digits'
     '(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size'
     '(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size'
     '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size'
@@ -7634,10 +7973,12 @@ __git_setup_diff_options () {
     '--diff-filter=-[select certain kinds of files for diff]: :_git_diff_filters'
     '-S-[look for differences that add or remove the given string]:string'
     '-G-[look for differences whose added or removed line matches the given regex]:pattern'
-    '--find-object=[look for differences that change the number of occurrences of the specified object]:object:__git_blobs'
     '--pickaxe-all[when -S finds a change, show all changes in that changeset]'
     '--pickaxe-regex[treat argument of -S as regular expression]'
     '-O-[output patch in the order of glob-pattern lines in given file]: :_files'
+    '--rotate-to=[show the change in specified path first]:path:_directories'
+    '--skip-to=[skip the output to the specified path]:path:_directories'
+    '--find-object=[look for differences that change the number of occurrences of specified object]:object:__git_blobs'
     '-R[do a reverse diff]'
     '--relative=-[exclude changes outside and output relative to given directory]:: :_directories'
     '(-a --text)'{-a,--text}'[treat all files as text]'
@@ -7645,13 +7986,13 @@ __git_setup_diff_options () {
     '--ignore-cr-at-eol[ignore carriage-return at end of line]'
     '(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]'
     '(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
-    '--ignore-blank-lines[do not show hunks that add or remove blank lines]'
+    '--ignore-blank-lines[ignore changes whose lines are all blank]'
+    \*{-I+,--ignore-matching-lines=}'[ignore changes whose lines all match regex]:regex'
     '--no-indent-heuristic[disable heuristic that shifts diff hunk boundaries to make patches easier to read]'
     '--inter-hunk-context=[combine hunks closer than N lines]:number of lines'
     '--output-indicator-new=[specify the character to indicate a new line]:character [+]'
     '--output-indicator-old=[specify the character to indicate a old line]:character [-]'
     '--output-indicator-context=[specify the character to indicate a context line]:character [ ]'
-    '--exit-code[report exit code 1 if differences, 0 otherwise]'
     '(           --no-ext-diff)--ext-diff[allow external diff helper to be executed]'
     '(--ext-diff              )--no-ext-diff[disallow external diff helper to be executed]'
     '(--textconv --no-textconv)--textconv[allow external text conversion filters to be run when comparing binary files]'
@@ -7660,12 +8001,13 @@ __git_setup_diff_options () {
     '(--no-prefix)--src-prefix=[use given prefix for source]:prefix'
     '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix'
     '--line-prefix=[prepend additional prefix to every line of output]:prefix'
-    '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]'
-
+    "(--src-prefix --dst-prefix)--no-prefix[don't show any source or destination prefix]"
+    '!(--src-prefix --dst-prefix --no-prefix)--default-prefix'
     '(-c --cc)'{-c,--cc}'[combined diff format for merge commits]'
-
-    # TODO: --output is undocumented.
-    '--output[undocumented]:undocumented')
+    '--output=[output to a specific file]: :_files'
+    '--expand-tabs=-[replace each tab with spaces]::tab width [8]'
+    '!(--expand-tabs)--no-expand-tabs'
+  )
 }
 
 (( $+functions[__git_setup_diff_stage_options] )) ||
@@ -7775,11 +8117,15 @@ __git_format_placeholders() {
 
 (( $+functions[__git_setup_revision_options] )) ||
 __git_setup_revision_options () {
-  local -a diff_options
-  __git_setup_diff_options
+  if [[ $1 = "-d" ]]; then # don't include diff options if passed -d
+    revision_options=()
+  else
+    local -a diff_options
+    __git_setup_diff_options
+    revision_options=( $diff_options )
+  fi
 
-  revision_options=(
-    $diff_options
+  revision_options+=(
     '(-v --header)'{--pretty=-,--format=-}'[pretty print commit messages]::format:__git_format_placeholders'
     '(--abbrev-commit --no-abbrev-commit)--abbrev-commit[show only partial prefixes of commit object names]'
     '(--abbrev-commit --no-abbrev-commit)--no-abbrev-commit[show the full 40-byte hexadecimal commit object name]'
@@ -7799,8 +8145,8 @@ __git_setup_revision_options () {
     '--count[display how many commits would have been listed]'
     '(-n --max-count)'{-n+,--max-count=}'[maximum number of commits to display]: :__git_guard_number'
     '--skip=[skip given number of commits before output]: :__git_guard_number'
-    '(--max-age --since --after)'{--since=,--after=}'[show commits more recent than given date]:date'
-    '(--min-age --until --before)'{--until=,--before=}'[show commits older than given date]: :__git_guard_number timestamp'
+    '(--max-age --since --after)'{--since=,--after=}'[show commits more recent than given date]: :_git_approxidates'
+    '(--min-age --until --before)'{--until=,--before=}'[show commits older than given date]: :_git_approxidates'
     '(          --since --after)--max-age=-[maximum age of commits to output]: :__git_guard_number timestamp'
     '(          --until --before)--min-age[minimum age of commits to output]: :__git_guard_number timestamp'
     '*--author=[limit commits to those by given author]:author'
@@ -7827,8 +8173,7 @@ __git_setup_revision_options () {
     '--tags=-[show all commits from refs/tags]::pattern'
     '--remotes=-[show all commits from refs/remotes]::pattern'
     '--glob=[show all commits from refs matching glob]:pattern'
-    '--exclude=[do not include refs matching glob]:pattern'
-    '--exclude=[do not include refs matching glob]:pattern'
+    "--exclude=[don't include refs matching glob]:pattern"
     '--ignore-missing[ignore invalid object an ref names on command line]'
     '--bisect[pretend as if refs/bisect/bad --not refs/bisect/good-* was given on command line]'
     '(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]'
@@ -7856,7 +8201,7 @@ __git_setup_revision_options () {
     '(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]'
     '(-c --cc            )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]'
     '--log-size[print log message size in bytes before the message]'
-    '--use-mailmap[use mailmap file to map author and committer names and email]'
+    --{use-,}mailmap'[use mailmap file to map author and committer names and email]'
 
     '--reflog[show all commits from reflogs]'
     '--single-worktree[examine the current working tree only]'
@@ -7886,13 +8231,14 @@ __git_setup_merge_options () {
     '(-n --no-stat)--stat[show a diffstat at the end of the merge]'
     '(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]'
     '(         --no-squash)--squash[merge, but do not commit]'
-    '--signoff[add Signed-off-by:]'
+    '--autostash[automatically stash/stash pop before and after]'
+    '--signoff[add Signed-off-by: trailer]'
     '(--squash            )--no-squash[merge and commit]'
     '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]'
     '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id'
     "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]"
-    '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
-    '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option'
+    '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
+    '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options'
     '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]'
     '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]'
     '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]'
@@ -7913,6 +8259,7 @@ __git_setup_fetch_options () {
     '--refmap=[specify refspec to map refs to remote tracking branches]:refspec'
     '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]'
     '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]'
+    '--porcelain[machine-readable output]'
     '--dry-run[show what would be done, without making any changes]'
     '(-f --force)'{-f,--force}'[force overwrite of local reference]'
     '(-k --keep)'{-k,--keep}'[keep downloaded pack]'
@@ -7932,6 +8279,11 @@ __git_setup_fetch_options () {
     '(-q --quiet)--progress[force progress reporting]'
     '--show-forced-updates[check for forced-updates on all updated branches]'
     '--set-upstream[set upstream for git pull/fetch]'
+    '--shallow-since=[deepen history of shallow repository based on time]:time' \
+    '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \
+    '--deepen[deepen history of shallow clone]:number of commits' \
+    \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option'
+    '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \
   )
 }
 
@@ -8302,19 +8654,19 @@ _git() {
     # TODO: This needs an update
     # TODO: How do we fix -c argument?
     _arguments -C \
-      '(- :)--version[display version information]' \
+      '(- :)'{-v,--version}'[display version information]' \
       '(- :)--help[display help message]' \
       '-C[run as if git was started in given path]: :_directories' \
-      '*-c[pass configuration parameter to command]: :->configuration' \
+      \*{-c,--config-env=}'[pass configuration parameter to command]: :->configuration' \
       '--exec-path=-[path containing core git-programs]:: :_directories' \
       '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \
       '(: -)--info-path[print the path where the info files are installed and exit]' \
       '(: -)--html-path[display path to HTML documentation and exit]' \
       '(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe output into a pager]' \
       '(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \
-      '--git-dir=-[path to repository]: :_directories' \
-      '--work-tree=-[path to working tree]: :_directories' \
-      '--namespace=-[set the Git namespace]:namespace' \
+      '--git-dir=[path to repository]: :_directories' \
+      '--work-tree=[path to working tree]: :_directories' \
+      '--namespace=[set the Git namespace]:namespace' \
       '--bare[use $PWD as repository]' \
       '--no-replace-objects[do not use replacement refs to replace git objects]' \
       '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \
@@ -8361,7 +8713,7 @@ _git() {
 }
 
 # Load any _git-* definitions so that they may be completed as commands.
-declare -gUa _git_third_party_commands
+declare -gA _git_third_party_commands
 _git_third_party_commands=()
 
 local file input
@@ -8383,7 +8735,7 @@ for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do
     (( i++ ))
   done < $file
 
-  _git_third_party_commands+=$name$desc
+  _git_third_party_commands+=([$name]=$desc)
 done
 
 _git