CentOS環境實現Git命令自動補全

來源:互聯網
上載者:User

Git就不用多介紹了,在Linux環境下開發的同學可能會發現預設已經安裝的Git卻並沒有能實現命令的自動補全,還是感覺有點低效和不爽,因此我們需要調整下。下面直接步入正題。

1、下載源碼,主要是使用源碼中的一個自動補齊命令的bash檔案。

[root@PHPHa ~]# git clone https://github.com/git/git
Initialized empty Git repository in /root/git/.git/
remote: Counting objects: 186987, done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 186987 (delta 197), reused 51 (delta 51), pack-reused 186708
Receiving objects: 100% (186987/186987), 62.05 MiB | 4.46 MiB/s, done.
Resolving deltas: 100% (136278/136278), done.

2、將源碼目錄下的 git-completion.bash 複製到 /etc/bash_completion.d/ 目錄下。

[root@PHPHa git]# cp contrib/completion/git-completion.bash /etc/bash_completion.d/

3、載入bash指令碼。

[root@PHPHa git]# . /etc/bash_completion.d/git-completion.bash

4、調整該指令碼的自動載入。


#編輯 /etc/profile 和 ~/.bashrc 檔案,加入下面的代碼。
# Git bash autoload
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
. /etc/bash_completion.d/git-completion.bash
fi

另外說點題外話,部落格好久沒更新了,一是因為懶,二是因為懶,三是因為懶……
自己的阿里雲ECS目前就掛了一個部落格,感覺有點浪費,所以也拿來做開發環境了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.