LoginSignup
2
1

More than 1 year has passed since last update.

Github — コンソールからGithubレポジトリをWebブラウザで開く

Last updated at Posted at 2018-08-12

git remote コマンドの1行目から https のURLを抜き出して open コマンドで開く例。

Macの場合

$ open $(git remote --verbose | head -n 1 | awk '{ print $2 }')

git config への登録例

[alias]
  open=!open $(git remote --verbose | head -n 1 | awk '{ print $2 }')

( @yuta0801 さんアイディア )

Windowsの場合

Windowsでは openstart に変えると動くようです。( @yuta0801 さん情報 )

前提

  • https protocol を利用していること
    • git remove --verbose の1行目でURLが取れること
origin	https://github.com/YumaInaura/gist (fetch)
origin	https://github.com/YumaInaura/gist (push)

もっと単純な例

先述の例のように動的に値をとらず、固定でURLを書いておいても良い。

URLだけを記録したファイルを作成しておく。

echo 'https://github.com/YumaInaura/gist' >> .github.url
open $(cat .github.url)

このファイルを git commit しておけば、いつでも手早く開けていいかんじ。

関連

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

2
1
2

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
2
1