无法使用 repo 工具签出分支
Unable to checkout a branch with repo tool
我正在尝试使用 repo
工具检查一个分支。我要执行的步骤是:
初始化存储库
repo init -u https://meh
同步
回购同步
为所有项目启动 master
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-1234
repo 签出 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
工具如何映射两个分支,但我不确定 if/how 我能做到。
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
repo checkout BUG-1234
将基于本地分支 `master' 创建一个本地分支。
请使用以下命令创建本地分支以跟踪远程分支。
git checkout --track git-server/BUG-1234
顺便说一句,您可以使用以下命令检查您的本地分支是否正在跟踪远程分支。
git branch -a -vv
我正在尝试使用 repo
工具检查一个分支。我要执行的步骤是:
初始化存储库
repo init -u https://meh
同步
回购同步
为所有项目启动 master
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 签出 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
工具如何映射两个分支,但我不确定 if/how 我能做到。
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
repo checkout BUG-1234
将基于本地分支 `master' 创建一个本地分支。
请使用以下命令创建本地分支以跟踪远程分支。
git checkout --track git-server/BUG-1234
顺便说一句,您可以使用以下命令检查您的本地分支是否正在跟踪远程分支。
git branch -a -vv