LoginSignup
0
0

More than 1 year has passed since last update.

一発で、現在のrepoのremote urlとpathをブラウザで開く方法

Posted at

TL;DR

% [sudo] gem install git-browse-remote 
% git browse-remote .

その他の方法

1. 自作


% sudo cat >> /usr/local/bin/gitremote << 'END'
git remote -v | awk -v P="$(git rev-parse --show-prefix | sed 's/\/$//g' | nkf -WwMQ | sed 's/=$//g' | tr = % | tr -d '\n')" '/origin.*push/ { sub(/\.git$/, "", $2); newvar=$2"/tree/master/"P; print newvar}' | xargs open
END

% sudo chmod +x /usr/local/bin/gitremote

% gitremote

2. git-open

% git open
# 残念なことに、現在のpathはサポートされていない

3. git-browse-remote (おすすめ)

% git br
% vi ~/.gitconfig

# This is Git's per-user configuration file.
[pull]
        ff = only
[init]
        defaultBranch = master
[web]
        browser = open
[alias]
        br = browse-remote .
        pr = browse-remote --pr

4. hub

多機能で、開くだけなら git-browse-remote

0
0
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
0
0