ฉันได้ผลักดันไปยังที่เก็บ Bitbucket ระยะไกลและเมื่อไม่นานมานี้เพื่อนร่วมงานได้ผลักดันสาขาใหม่ที่เขาสร้างไปยังที่เก็บเดียวกัน
ฉันพยายามดึงการเปลี่ยนแปลงที่เขาอัปโหลด
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
สาขา $ git -r ต้นกำเนิด / ต้นแบบ
ใน UI ของเว็บสำหรับ Bitbucket ฉันสามารถดูสาขาที่เขาสร้างขึ้นได้ ฉันจะทำเช่นนี้ได้อย่างไร?
ลองครั้งต่อไป:
$ 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
ลองครั้งที่สาม:
$ 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
ลองครั้งที่สี่:
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
ฉันเรียกรีโมตbitbucketมากกว่าที่มา (อย่างน้อยนั่นคือสิ่งที่ฉันจำได้ฉันตั้งค่าไว้เมื่อครู่แล้ว)
ลองครั้งที่ห้า:
ฉันอัปเดตการกำหนดค่าระยะไกล Bitbucket ตามคำตอบของ kan :
$ 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เช่นกัน
refs/remotes/bitbucket/*refs/remotes/origin/*