I tried to Tab autocomplete git reflog --<tab> and I could not get a list of parameters.

However, the same works for git stash --<tab>.

git stash --
--all                 --keep-index          --patch 
--include-untracked   --no-keep-index       --quiet 

Why I cannot autocomplete reflog command? This is the only one I realized that tab autocomplete does not work, but there may be others.


You are expecting auto-completion in a wrong place. This is the reference from man git-reflog:

       git reflog <subcommand> <options>

       The command takes various subcommands, and different options depending on the subcommand:

           git reflog [show] [log-options] [<ref>]
           git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
                   [--rewrite] [--updateref] [--stale-fix]
                   [--dry-run] [--verbose] [--all | <refs>...]
           git reflog delete [--rewrite] [--updateref]
                   [--dry-run] [--verbose] ref@{specifier}...
           git reflog exists <ref>

As it is clear there, you need to mention a subcommand (show, expire, or delete) right after reflog and then use options.


The completions appear to come from the file /usr/share/bash-completion/completions/git, and if you search for git_stash you will see that options are defined, but if you search for git_reflog the provided completion help is much thinner.

So I think the answer is the help was felt to be less important, and the effort was not taken to provide it.

Also, there is the potential for the completions not to be 100% in sync with the program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.