86
59

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【2ステップ】Gitコマンドでtab補完を有効にする

Posted at

#意外と簡単にtab補完するようにできる

git-completion.bashという設定ファイルがあり、.bashrcにパスを通すだけでtab補完できるようになる。

#手順

ステップ1:git-completion.bash のパスを見つける

sudo find / -name git-completion.bash

で検索。

私の場合は
/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash
だった。
SourceTreeを入れているので
/Applications/SourceTree.app/Contents/Resources/git_local/contrib/completion/git-completion.bash
もヒットしたが、あくまでコマンドラインで使いたいので前者を選んだ。

##ステップ2:.bashrc に git-completion.bash のpathを追記
vi ~/.bashrcで開いて

source /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash 

を追加する。

これだけでgitコマンドの最中にtabで補完できるようになる。

86
59
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
86
59

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?