2016-10-04 7 views
0

ブラウザウィンドウでGithubプルリクエストを開くためのbashスクリプトを作成しようとしています。ここでBASHスクリプト内でgit repo名とgithub usernameを取得しますか?

私は実行する必要があるコマンドです:


オープンhttps://github.com/ParentOwner/RepoName /比較/ を開発... JoshuaSoileauは:CurrentBranch


もの大胆にダイナミックにする必要があります。

私はbashで以下のものを引っ張っする方法を見つけ出す必要があります。

RepoName  - name of the repo 
develop  - ARGUMENT to my bash script 
JoshuaSoileau - github username of the current user 
CurrentBranch - name of the currently checked out git branch. 

私は次の操作を実行する方法を知っている:

私は 1. RepoNameを引くにはどうすればよい
RepoName  - ?? 
develop  - $1 argument in my bash script 
JoshuaSoileau - ?? 
CurrentBranch - $(git rev-parse --abbrev-ref HEAD) 

BASHスクリプトの2. Current github username

git-open-merge() { 
    open https://github.com/ParentOwner/??/compare/$1...??:$(git rev-parse --abbrev-ref HEAD) 
} 

そして、それはこのように呼ばれています:

は、これは私がこれまで持っているものである

git-open-merge develop 

答えて

0

あなたが使用することができます。

git config --get-regexp user.name 

ユーザー名についてリポジトリ名のために、あなたは異なる名前の異なるリポジトリを有することができるので、私はパース推測:あなたが唯一の原点を心配している場合

git remote get-url origin 

を助けることができますか?形式は(プレフィックスはsshまたはhttpsの間で異なります)[email protected]:{github_handle}/{repo_name}.git

関連する問題