私はリモートの Bitbucket リポジトリにプッシュしていましたが、最近、同僚が作成した新しいブランチを同じリポジトリにプッシュしました。
彼がアップロードした変更を取得しようとしています。
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
$ git ブランチ -r オリジン/マスター
Bitbucket の Web UI で、彼が作成したブランチを確認できます。これどうやってするの?
次の試行:
$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
彼が作成したブランチがnew_branch_bと呼ばれる場合、次のように表示されることを期待する必要がありますか?
$ git branch -r
origin/master
origin/new_branch_b
3 回目の試行:
$ git remote update
Fetching bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
$ git branch -r
origin/master
4 回目の試行:
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
オリジンではなくリモートに電話しましたbitbucket
(少なくともそれは私が覚えていることです。少し前にセットアップしました)
5 回目の試行:
kan の回答に従って、Bitbucket リモート構成を更新しました。
$ git config -e
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
ほとんどの人にとって、それはオリジンと呼ばれます:
[remote "origin"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
その後、
$ git remote update
Fetching bitbucket
Password for 'https://user@bitbucket.org':
remote: Counting objects: 48, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 35 (delta 21), reused 0 (delta 0)
Unpacking objects: 100% (35/35), done.
From https://bitbucket.org/user/repo
* [new branch] branch_name1 -> origin/branch_name1
* [new branch] branch_name2 -> origin/branch_name2
.... 等々。
git fetch origin
にも使えると思いますgit remote update
。