我正在尝试使用repo
工具查看分支。我正在遵循的步骤是:
初始化存储库
repo init -u https://meh
同步
repo sync
启动所有项目的主人
repo start master --all
现在其中一个存储库看起来像这样:
* 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
尝试使用
结帐分行BUG-1234repo checkout 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
答案 0 :(得分:1)
repo checkout BUG-1234
将根据本地分支`master'。
请使用以下命令创建本地分支以跟踪远程分支。
git checkout --track git-server / BUG-1234
顺便说一句,您可以使用以下命令检查您的本地分支是否正在跟踪远程分支。
git branch -a -vv