1

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

  1. 初始化存储库

    回购初始化-u https://meh

  2. 同步它

    回购同步

  3. 启动所有项目的 master

    回购开始大师--全部

现在其中一个存储库如下所示:

*   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

    回购结帐BUG-1234

我在这一点上面临的问题是 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           
4

1 回答 1

1

repo checkout BUG-1234将基于本地分支“master”创建一个本地分支。

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

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

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

git 分支 -a -vv

于 2016-04-15T09:23:26.960 回答