Skip to main content

Github的小妙招

huhxLess than 1 minuteTips

打开当前项目的github

在用户的profile中添加下列函数,这样就可以在项目目录下使用gh打开所在的github

function gh() {
    url=https://github.$(git config remote.origin.url | cut -f2 -d. | tr ':' '/')
    open $url
}

如果一个目录下面,有多个repo。想要更新所有的repo,也可以像上面一样定义

function gitall() {
    for i in */.git; do ( echo $i | cut -d '/' -f 1; cd $i/..; gupa; ); 
}

其中上述的gupa是设置alias: gupa=git pull --rebase --autostash