我可以通过 cmd.exe 在 Windows 上为 git 设置自动完成吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6464610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I setup auto-complete for git on Windows via cmd.exe?
提问by ripper234
I've recently learned that on linux, git can be setup to autocomplete commands: If you type
我最近了解到在 linux 上,git 可以设置为自动完成命令:如果你输入
git br<TAB>
git br<TAB>
Then it will complete it to git branch
.
然后它将完成它git branch
。
Can the same auto-completion be set up on Windows?
可以在 Windows 上设置相同的自动完成吗?
Update- I'm usually working with git via cmd.exe (I added git to my path). This question is about adding auto-completion to git on cmd, if that's possible.
更新- 我通常通过 cmd.exe 使用 git(我将 git 添加到我的路径中)。如果可能的话,这个问题是关于在 cmd 上向 git 添加自动完成功能。
采纳答案by ralphtheninja
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.
您必须使用某种形式的 bash 才能使其工作,无论是 msysgit 附带的 git bash 还是其他一些 bash(您需要设置它以使用 git bash 中使用的自动完成功能)。使用 cmd.exe 你不会走运。
Look at this as a sign for you to leave old rusty cmd.exe behind. Enter the light of bash! : )
将此视为您将旧生锈的 cmd.exe 抛在脑后的标志。进入 bash 之光!:)
回答by jordanpg
Installing Clink seems to make this work by magic, verified in cmd, Console2, and ConEmu.
安装 Clink 似乎使这项工作变得神奇,在 cmd、Console2 和 ConEmu 中得到验证。
http://mridgers.github.io/clink/
http://mridgers.github.io/clink/
UPDATE: To get ConEmu and clink to work properly with the more recent versions, it was necessary to install clink into the ConEmu folder. See https://github.com/mridgers/clink/issues/339and https://github.com/Maximus5/ConEmu/issues/270for more info.
更新:为了让 ConEmu 和 clink 在更新的版本中正常工作,有必要将 clink 安装到 ConEmu 文件夹中。有关更多信息,请参阅https://github.com/mridgers/clink/issues/339和https://github.com/Maximus5/ConEmu/issues/270。
回答by ShawnLee
回答by Abhilash
If you are comfortable in using linux commands along with git instead of cmd commands then open git-bash.exe which should be in the installation folder(I used portable version and it's in installation folder). Voila! Auto-completion is already there. No setup. But if you wanna proceed with cmd commands follow this link :set up auto-complete
如果您习惯于将 linux 命令与 git 而不是 cmd 命令一起使用,请打开 git-bash.exe,它应该位于安装文件夹中(我使用的是便携式版本,它位于安装文件夹中)。瞧!自动完成已经存在。没有设置。但是,如果您想继续使用 cmd 命令,请按照此链接:设置自动完成