我如何设置自动完成的Git命令? [英] How can I set up autocompletion for Git commands?

查看:141
本文介绍了我如何设置自动完成的Git命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Git(版本1.7.2.5)庆典上compeletion我的Debian挤压(6.0)工作。 Git的安装与资质和我使用标准Debian的庆典,它支持命令行自动完成。

现在,我只是一个其他机器(莱尼/ Debian的5.0)上安装的Git(1.5.6.5)和没有自动完成。


  1. 为什么不工作的第二台机器上的Git自动完成?我该如何诊断呢?


  2. 什么让我的机器上完成的工作?我已经看过的文件混帐completion.bash ,但它似乎并没有被我的机器上。如何完成的Git工作过?


  3. 如何使我能完成的git的其他机器?



解决方案

您需要源/etc/bash_completion.d/git 启用git的自动完成功能。

在我的的.bashrc 它与完成的:

 在/etc/bash_completion.d/*文件;做
    源$文件
DONE

I have Git (version 1.7.2.5) bash compeletion working on my Debian squeeze (6.0). Git was installed with aptitude and I am using standard debian's bash, which supports command line autocompletion.

Now, I just installed Git (1.5.6.5) on an other machine (Lenny/Debian 5.0) and the there is no autocompletion.

  1. Why is Git autocomplete not working on the second machine? How do I diagnose this?

  2. What is making completion work on my machine? I have looked for the file git-completion.bash but it doesn't seem to be on my machine. How does Git complete ever work?

  3. How can I bring git complete to the other machine?

解决方案

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

这篇关于我如何设置自动完成的Git命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆