我正试图结帐https://github.com/Miserlou/Zappa/commit/54a6fa4542a4ae26d5a8155b63a50701ab69c1f8.
$ git clone https://github.com/Miserlou/Zappa.git
Cloning into 'Zappa'...
remote: Enumerating objects: 15029, done.
remote: Total 15029 (delta 0), reused 0 (delta 0), pack-reused 15029
Receiving objects: 100% (15029/15029), 4.71 MiB | 932.00 KiB/s, done.
Resolving deltas: 100% (11418/11418), done.
$ cd Zappa
$ git checkout 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8
fatal: reference is not a tree: 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
这里的问题54a6fa4542a4ae26d5a8155b63a50701ab69c1f8是只有一半在存储库中https://github.com/Miserlou/Zappa.
也就是说,如果您克隆https://github.com/Miserlou/Zappa,则会获得一个有效的存储库,其中包含少于3000个提交. 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8是不是这些提交的一个.
实际上,54a6fa4542a4ae26d5a8155b63a50701ab69c1f8是另一个存储库中的提交.你可以看到这个https://github.com/Miserlou/Zappa/pull/1762,其中包括:
Open purificant wants to merge 1 commit into Miserlou:master from purificant:py37
Run Code Online (Sandbox Code Playgroud)
所以这个提交purificant在分支名称下的fork中更合适py37(将鼠标悬停在某些标签上,你会在弹出窗口中看到更多细节).
但是,一旦有人在GitHub上发出pull请求,那些提交也可以通过目标存储库获得.它只需要一些技巧:
git fetch origin refs/pull/1762/head:refs/heads/pr1762
Run Code Online (Sandbox Code Playgroud)
现在git show 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8和git checkout 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8工作.
$ git checkout 54a6fa4542a4ae26d5a8155b63a50701ab69c1f8
Note: checking out '54a6fa4542a4ae26d5a8155b63a50701ab69c1f8'.
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 54a6fa4 python3.7 support
Run Code Online (Sandbox Code Playgroud)
(我不清楚不是我的人会怎么想这个.:-))
(pr1762我在这里使用的原始名称不是很好,我编辑它来refs/heads/pr1762代替.)
| 归档时间: |
|
| 查看次数: |
36 次 |
| 最近记录: |