How can I set up autocompletion for Git commands?
You need to source /etc/bash_completion.d/git
to enable git auto-completion.
In my .bashrc
it's done with:
for file in /etc/bash_completion.d/* ; do
source "$file"
done
How to setup auto complete alias for git commands?
Do not define completions like complete -F _git_checkout .o
.
Use the alias completion code (pointed to by Ansgar Wiechers above). After sourcing that script, completions like
complete -o bashdefault -o default -o nospace -F _alias_completion::.o .o
have been defined.
Can I setup auto-complete for git on Windows via cmd.exe?
You have to use some form of bash to get it to work, either git bash that comes with msysgit or some other bash (which you need to setup to use the autocompletion used in git bash). With cmd.exe you will have no luck.
Look at this as a sign for you to leave old rusty cmd.exe behind. Enter the light of bash! : )
How to enable auto-completion with Git [all platforms]
You need to get bash
's programmable completion configured to return the possible commands. You can see the "Programmable Completion" section in the bash
man page if you want to implement it yourself.
A much easier method to use a script to pre-configure bash's programmable completion. On most distributions, the file for git completion, /etc/bash_completion.d/git
(on Fedora and derivatives), /usr/share/bash-completion/completions/git
(on Debian and derivatives) (other distributions might have it in other places, try locate
or find
to locate it) are provided by the git
package. (If it is not included with your git package, you can get it from here).
You can configure bash
to source the file when it is started (probably using .bashrc
), or you can install bash-completion
, which will automatically load completions like the one that the git
package installs (and generally completions from /etc/bash_completion.d/
or /usr/local/etc/bash_completion.d/
(typically BSDs)). On most distributions, bash-completion
should be available in the repositories and you can simply install the package. For other systems, see the instructions included in the README.md
to install it. (On non-GNU/Linux systems, some completions might need to be disabled to prevent it from outputting errors when starting)
Autocomplete branch name in Intellij's GIT terminal on Windows 10
IntelliJ IDEA Terminal just runs the shell that you've configured, it doesn't provide any additional features or completion to this shell.
If the shell you are using supports branch names completion, it will work in the Terminal tool window as well.
http://dahlbyk.github.io/posh-git/ may be an option if you change the shell to PowerShell executable.
Related Topics
Linux: How to Force a Specific Network Interface to Be Used
How to Mount an Iso Inside a Docker Container
Mongodb Service Will Not Start After Initial Setup
How to Do Http-Request/Call with JSON Payload from Command-Line
Docker Load and Save: "Archive/Tar: Invalid Tar Header"
Process Permanently Stuck on D State
How to Continuously Display a File of Its Last Several Lines of Contents
Storing & Accessing Up to 10 Million Files in Linux
Signing into Slack-Desktop Not Working on 4.23.0 64-Bit (Ubuntu)
How to Programmatically Switch to a Specific Window in Compiz
Startup Script with Systemd in Linux
How to Convert Pe(Portable Executable) Format to Elf in Linux
How to Run Processes Piped with Bash on Multiple Cores