We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git って打つのが大変だから g と打っただけで git って書いたことにできるように .bashrc で alias を設定しているけど、g って打ったときは git-completion のブランチ名の補完が効かなかった。ブランチ名を補完したいときは git ってちゃんと書くことで生活してた。しかし、g と打ったときも git-completion の補完を利用できるようにする方法があった!
git
g
.bashrc
git-completion を利用するために、.bashrc または .bash_profile に以下のようなパスを指定している記述があると思う。書いてなくても利用できる方法あるのかな…?
.bash_profile
source /usr/local/git/contrib/completion/git-prompt.sh source /usr/local/git/contrib/completion/git-completion.bash
自分の環境では .bashrc に、上記のように指定してあった。 /usr/local/git/contrib/completion/git-completion.bash を好きなエディタで開いて、末尾に以下のコードを追記する。
/usr/local/git/contrib/completion/git-completion.bash
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ || complete -o default -o nospace -F _git g
保存して $ source ~/.bashrc を実行して再読み込みすると、g だけ打ってもブランチ名の補完が効くようになった。やったー!
$ source ~/.bashrc
The text was updated successfully, but these errors were encountered:
Thanks :)
Sorry, something went wrong.
No branches or pull requests
git
って打つのが大変だからg
と打っただけでgit
って書いたことにできるように.bashrc
で alias を設定しているけど、g
って打ったときは git-completion のブランチ名の補完が効かなかった。ブランチ名を補完したいときはgit
ってちゃんと書くことで生活してた。しかし、g
と打ったときも git-completion の補完を利用できるようにする方法があった!git-completion を利用するために、
.bashrc
または.bash_profile
に以下のようなパスを指定している記述があると思う。書いてなくても利用できる方法あるのかな…?自分の環境では
.bashrc
に、上記のように指定してあった。/usr/local/git/contrib/completion/git-completion.bash
を好きなエディタで開いて、末尾に以下のコードを追記する。保存して
$ source ~/.bashrc
を実行して再読み込みすると、g
だけ打ってもブランチ名の補完が効くようになった。やったー!参考
The text was updated successfully, but these errors were encountered: