无法使用repo工具签出分支

时间:2016-04-04 20:04:50

标签: git repo

我正在尝试使用repo工具查看分支。我正在遵循的步骤是:

  1. 初始化存储库

    repo init -u https://meh

  2. 同步

    repo sync

  3. 启动所有项目的主人

    repo start master --all

  4. 现在其中一个存储库看起来像这样:

    *   4d35068 4 hours ago (user1)         (HEAD, m/master, git-server/master, master)   Merge branch 'BUG-1234' into 'master'
    |\                                                                  
    | |                                                                 
    | * 5f5bef7 4 hours ago (user1)         (git-server/BUG-1234)   BUG-1234: fixing something
    | |                                                                 
    * | 86aa598 4 hours ago (user2)           BUG-1235: Bug fixing      
    | |                                                                 
    * | 9a5511d 5 hours ago (user2)           BUG-1235: fixing something
    | |                                                                 
    | |                                                                 
    * | 6a9a6c5 5 hours ago (user2)           BUG-1235: fixing something 
    |/                                                                  
    |                                                                   
    * 33d9c96 7 hours ago (user2)     BUG-1235: fixing code     
    
    1. 尝试使用

      结帐分行BUG-1234

      repo checkout BUG-1234

    2. 我现在面临的问题是,HEAD没有像我期望的那样指向5f5bef7,而是指向4d35068

      *   4d35068 4 hours ago (user1)         (HEAD, m/master, git-server/master, topbeat-b1, master, BUG-1234)   Merge branch 'BUG-1234' into 'master'
      |\                                                                  
      | |                                                                 
      | * 5f5bef7 4 hours ago (user1)         (git-server/BUG-1234)   BUG-1234: fixing something
      | |                                                                 
      * | 86aa598 4 hours ago (user2)           BUG-1235: Bug fixing      
      | |                                                                 
      * | 9a5511d 5 hours ago (user2)           BUG-1235: fixing something
      | |                                                                 
      | |                                                                 
      * | 6a9a6c5 5 hours ago (user2)           BUG-1235: fixing something 
      |/                                                                  
      |                                                                   
      * 33d9c96 7 hours ago (user2)     BUG-1235: fixing code                      
      

      我想我没有告诉repo工具如何映射这两个分支,但我不确定是否/如何做到这一点。

      repo checkout BUG-1234之后的预期结果:

      *   4d35068 4 hours ago (user1)         (HEAD, m/master, git-server/master, topbeat-b1, master)   Merge branch 'BUG-1234' into 'master'
      |\                                                                  
      | |                                                                 
      | * 5f5bef7 4 hours ago (user1)         (git-server/BUG-1234, BUG-1234)   BUG-1234: fixing something
      | |                                                                 
      * | 86aa598 4 hours ago (user2)           BUG-1235: Bug fixing      
      | |                                                                 
      * | 9a5511d 5 hours ago (user2)           BUG-1235: fixing something
      | |                                                                 
      | |                                                                 
      * | 6a9a6c5 5 hours ago (user2)           BUG-1235: fixing something 
      |/                                                                  
      |                                                                   
      * 33d9c96 7 hours ago (user2)     BUG-1235: fixing code           
      

1 个答案:

答案 0 :(得分:1)

repo checkout BUG-1234将根据本地分支`master'。

创建一个本地分支

请使用以下命令创建本地分支以跟踪远程分支。

  

git checkout --track git-server / BUG-1234

顺便说一句,您可以使用以下命令检查您的本地分支是否正在跟踪远程分支。

  

git branch -a -vv