2017-06-28 13 views
0

「リモートブランチ」に切り替えることができません - 以下上場GitBashからヘッド一戸建て「リモートブランチ」に切り替えることができません - ヘッド戸

出力(;リモートブランチが表示されている、合計2であること:マスターとトランク):

[Laptop1 ~/Desktop/User1 (master)]$ git branch -a 
* master 
    remotes/master/master 
    remotes/master/trunk 
    remotes/origin/master 
    remotes/origin/trunk 
[Laptop1 ~/Desktop/User1 (master)]$ git checkout remotes/master/master 
Note: checking out 'remotes/master/master'. 

You are in 'detached HEAD' state. You can look around, make experimental 
changes and commit them, and you can discard any commits you make in this 
state without impacting any branches by performing another checkout. 

If you want to create a new branch to retain commits you create, you may 
do so (now or later) by using -b with the checkout command again. Example: 

    git checkout -b <new-branch-name> 

HEAD is now at 57df590... Third coommit... 
[Laptop1 ~/Desktop/User1 ((57df590...))]$ git branch -a 
* (HEAD detached at master/master) 
    master 
    remotes/master/master 
    remotes/master/trunk 
    remotes/origin/master 
    remotes/origin/trunk 
[Laptop1 ~/Desktop/User1 ((57df590...))]$ 

答えて

0

インフォメーションメッセージには、「git checkout -b remote-master remotes/master/master」と表示されます。これにより、新しいブランチremote-masterremotes/master/masterから作成されます。ローカルのremote-masterブランチにリモートブランチを追跡させるには、オプションを使用してgit checkoutを呼び出します。

ローカルブランチが追跡するリモートブランチを確認するには、git branch -vを呼び出します。

gitを使い始めるには、おそらくgitのイントロを読むべきです(https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshellなど)。

+0

返信ありがとうございました。残念ながら私はGitに新しいです、なぜ私は* masterローカルブランチとリモートブランチ 'remotes/master/master'が存在する場合、新しいブランチ 'remote-master'を作成する必要がありますか? ? – xGIx

+0

リモートブランチを「チェックアウト」することはできません。リモートブランチは、最後に話をしたときのリモートの場所を追跡します。フェッチ/プッシュ/プルなどのブランチ以外のブランチを変更することはできません。リモートブランチをチェックアウトする唯一の方法は、リモートブランチからローカルブランチを作成することです。 –

関連する問題