我想現在從 github將 repo https://github.com/jiangxiaoqiang/crx-selection-translate代碼拉到我的本地機器上。我在 github 中的 google chrome 瀏覽器中切換到遠程 6.x-master 分支,發現該分支包含源代碼,但是當我想使用以下命令將源代碼拉入我的本地機器時:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git pull -v
POST git-upload-pack (122 bytes)
From https://github.com/jiangxiaoqiang/crx-selection-translate
= [up to date] 6.x-master -> origin/6.x-master
= [up to date] 4.x-master -> origin/4.x-master
= [up to date] 5.x-master -> origin/5.x-master
= [up to date] 7.x-master -> origin/7.x-master
= [up to date] porting-to-firefox -> origin/porting-to-firefox
Already up to date.
告訴我已經是最新的,但我的本地機器沒有包含任何源代碼:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git branch
* 6.x-master
7.x-master
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% ls
README.md
我錯過了什么嗎?我應該怎么做才能將 github 遠程6.x-master源代碼提取到我的本地機器中?我也試過這個命令:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git pull origin 6.x-master
From https://github.com/jiangxiaoqiang/crx-selection-translate
* branch 6.x-master -> FETCH_HEAD
Already up to date.
分支 6.x-master 是從我本地機器上的 7.x-master 結帳的。
在我的作業中,我總是使用這個命令從遠程分支 A 拉取本地分支 A:git pull origin A,它似乎在這個 repo 中不起作用。我不知道我哪里出錯了,這很奇怪。當我運行 git status 時,顯示如下資訊:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git status
On branch 6.x-master
Your branch is ahead of 'origin/6.x-master' by 16 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
然后我運行 git push 命令:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/jiangxiaoqiang/crx-selection-translate.git
5a9ca26..12b9ef2 6.x-master -> 6.x-master
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% git pull
Already up to date.
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% ls
README.md
還沒有6.x-master的源代碼。我也試過這個命令:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub% git clone -b 6.x-master https://github.com/jiangxiaoqiang/crx-selection-translate.git
Cloning into 'crx-selection-translate'...
remote: Enumerating objects: 4587, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 4587 (delta 27), reused 15 (delta 5), pack-reused 4502
Receiving objects: 100% (4587/4587), 1.55 MiB | 734.00 KiB/s, done.
Resolving deltas: 100% (2816/2816), done.
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub% cd crx-selection-translate
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% ls
README.md
仍然不包含源代碼。
uj5u.com熱心網友回復:
你寫了
分支 6.x-master 是從我本地機器上的 7.x-master 結帳的
你寫的輸出git status是
On branch 6.x-master
Your branch is ahead of 'origin/6.x-master' by 16 commits.
這告訴我你的情況是這樣的:
o <-- origin/7.x-master <-- 6.x-master
|
o
|
[... 14 other commits ...]
|
o
|
o <-- origin/6.x-master
|
o
|
但你想要:
o <-- origin/7.x-master
|
o
|
[... 14 other commits ...]
|
o
|
o <-- origin/6.x-master <-- 6.x-master
|
o
|
即,您當地的6.x.-master分支機構太領先了。
因此,您必須將其重置為origin/6.x-master:
git checkout 6.x-master
git reset --hard origin/6.x-master
你還寫了
[
git pull] 告訴我已經是最新的,但是我的本地機器沒有包含任何源代碼
沒有源代碼,因為那是當時origin/7.x-master分支的狀態,您已在本地名稱下簽出該狀態6.x-master。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/341644.html
標籤:混帐
