Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I disable a particular git command?

With new versions of git new commands have been added which I will probably never use.
Is there a way I can disable these commands so that I my tab completion is faster?
For ex: before, git check<tab> would autocomplete to git checkout
But now git check<tab> doesn't tab complete due to there being git check-mailmap in the newer git version.

This is just one of the example.

Alternatively it would be great if I could "force" git to tab-complete "check" to checkout .

Edit: I use vanilla bash with no extra modifications

like image 903
RuMAN S Avatar asked Jun 12 '18 10:06

RuMAN S


People also ask

How do you stop a git command?

If you are using the git cli directly, pressing q in the keyboard will also do the job for you. Show activity on this post. ctrl + c is the most used task killing command for command based working windows.

How Do I Get Out of git shell?

To exit from bash type exit and press ENTER . If your shell prompt is > you may have typed ' or " , to specify a string, as part of a shell command but have not typed another ' or " to close the string. To interrupt the current command press CTRL-C .

What option can the git config command apply configurations across the entire git environment?

Git stores all global configurations in . gitconfig file, which is located in your home directory. To set these configuration values as global, add the --global option, and if you omit --global option, then your configurations are specific for the current Git repository. You can also set up system wide configuration.


1 Answers

The official way is to use the configuration completion.commands and remove the ones you don't want:

git config --global completion.commands -check-mailmap

However, you can do even more. There is a hack in __git_main() used for testing that you can abuse to do what you want:

GIT_TESTING_PORCELAIN_COMMAND_LIST="$(git --list-cmds=list-mainporcelain,alias)"

This will force Git's completion to show only the main commands (and aliases).

You need Git v2.18 or newer for these to work.

like image 146
FelipeC Avatar answered Sep 30 '22 03:09

FelipeC