Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2912

hub browse のように gitlabやgithubのremoteアドレスからWebへジャンプするalias

$
0
0

やりかた

fish

~/.config/fish/config.fish
alias gibr='git remote get-url origin | sed -e \'s/ssh:\/\/git@/https:\/\//g\'-e\'s/:[0-9]\{2,\}//g\'-e\'s/.git$//g\' | xargs -I\{\} open {}'

bash

~/.bash_profile
alias gibr='git remote get-url origin | sed -e \'s/ssh:\/\/git@/https:\/\//g\'-e\'s/:[0-9]\{2,\}//g\'-e\'s/.git$//g\' | xargs -I\{\} open {}'

使う時

$ cd{.git があるディレクトリへ移動}$ gibr

概要

リモートのgitリポジトリを参照したい時に、わざわざWebで検索していました。

githubでは、hubコマンドによってリンク出来ますが、gitlabでは対応していません。
sshで登録されたリポジトリだった場合色々と置換しなければ行けないのでalias化しました。

以上


Viewing all articles
Browse latest Browse all 2912

Trending Articles