Git
如何判斷哪個本地分支正在跟踪 Git 中的哪個遠端分支?
我想知道是否有辦法告訴哪個本地分支正在跟踪 Git 中的哪個遠端分支。
我正在使用一台名為“origin”的遠端伺服器。
使用我從 Github.com 上的上游 Git 儲存庫中籤出的 Puppet 副本的範例…
$ git remote show origin * remote origin Fetch URL: git://github.com/reductivelabs/puppet.git Push URL: git://github.com/reductivelabs/puppet.git HEAD branch: master Remote branches: 0.24.x tracked 0.25.x tracked 2.6.x tracked master tracked next tracked primordial-ooze tracked reins-on-a-horse tracked testing tracked testing-17-march tracked testing-18-march tracked testing-2-april tracked testing-2-april-midday tracked testing-20-march tracked testing-21-march tracked testing-24-march tracked testing-26-march tracked testing-29-march tracked testing-31-march tracked testing-5-april tracked testing-9-april tracked testing4268 tracked Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (up to date)
然後,如果我要執行以下操作:
$ git checkout -b local_2.6 -t origin/2.6.x Branch local_2.6 set up to track remote branch 2.6.x from origin. Switched to a new branch 'local_2.6'
最後再次重新執行
git remote show origin
命令,我將在底部附近看到以下內容:Local branches configured for 'git pull': local_2.6 merges with remote 2.6.x master merges with remote master