Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

教程:如何同步更新学习用书(pilot-student)的新版本 #651

Closed
zhipingyang120 opened this issue Dec 2, 2019 · 12 comments
Closed
Labels
inspiring Inspiring question and/or answer

Comments

@zhipingyang120
Copy link

zhipingyang120 commented Dec 2, 2019

编程课 S1 阶段已经告一段落了:

重要提示: 之前已经 fork & clone 学习用书 的话,需要按照 GitHub 官方指南 来完成你的 repo 和新版学习用书之间的同步。 这个过程虽然不难,但也有点麻烦,如果实在弄不好,其实把之前你用的本地学习用书备份一下,然后删掉原本的 fork,再重新 fork & clone 新的学习用书就可以了。反正“描红本”描完就扔也没问题。

很多人看了 GitHub 官方指南 后仍旧感觉一团雾水,即便看了指南的中文版仍旧不知如何操作,在 Issues 上提问。

今天我就为大家解惑一下: 其实,如果大家仔细看了 支线课程 第二讲 - Git 和 GitHub 简明入门,自然知道如何操作。

假设大家还没来得及看,那么该如何操作?

首先,在 PowerShell 上打开 S1 阶段教程所在文件夹:

PS C:\Users\90522\code> cd .\pilot-student\

然后,运行:

C:\Users\90522\code\pilot-student> git remote -v

这个命令是查看远程版本。

我的出现了:

origin https://github.com/zhipingyang120/pilot-student.git (fetch)
origin https://github.com/zhipingyang120/pilot-student.git (push)

接着,运行:

PS C:\Users\90522\code\pilot-student> git remote add upstream https://github.com/neolee/pilot-student.git

upstream 后面接的网址是 pilot-student 学习用书在 GitHub 上对应的地址,你在网址的右上角点 Clone or download 就能看到并复制到。

接着,运行:

PS C:\Users\90522\code\pilot-student> git remote -v

我的出现了:

origin https://github.com/zhipingyang120/pilot-student.git (fetch)
origin https://github.com/zhipingyang120/pilot-student.git (push)
upstream https://github.com/neolee/pilot-student.git (fetch)
upstream https://github.com/neolee/pilot-student.git (push)

到这里就表示你为 复刻配置了远程仓库

然后,我们运行:

PS C:\Users\90522\code\pilot-student> git fetch upstream

接着,运行:

PS C:\Users\90522\code\pilot-student> git checkout master

紧接着,运行:

PS C:\Users\90522\code\pilot-student> git merge upstream/master

到这里就表示你已经 同步复刻 了。

最后,运行:

PS C:\Users\90522\code\pilot-student> git push

你再打开你 GitHub 上对应 pilot-student 的仓库,就会发现他们已经更新了。

是不是挺简单的?

当然了,如果你已经将 pilot-student S1 阶段这本书玩坏了,还是建议你:

如果实在弄不好,其实把之前你用的本地学习用书备份一下,然后删掉原本的 fork,再重新 fork & clone 新的学习用书就可以了。反正“描红本”描完就扔也没问题。

@neolee neolee added the inspiring Inspiring question and/or answer label Dec 2, 2019
@neolee neolee changed the title 教程:如何将李骏老师的S2段课程与S1段课程和并在一起? 教程:如何同步更新学习用书(pilot-student)的新版本 Dec 2, 2019
@dfdssgb
Copy link

dfdssgb commented Dec 2, 2019

如何册除原来的学习用书

@hailinsu
Copy link

hailinsu commented Dec 2, 2019

WPWN30$W(6GW27BG88AAPMV
zhe'ya这样算是完成了吗

@neolee
Copy link
Owner

neolee commented Dec 2, 2019

@hailinsu 没有,你 merge 没完成,因为你本地有修改未 commit,先 commit 本地所有的修改,然后在做一次 git merge。

@zhenrany
Copy link

zhenrany commented Dec 3, 2019

image
请问这是哪里出了问题?更新学习用书没有完成!

@neolee
Copy link
Owner

neolee commented Dec 3, 2019

@zhenrany 你的 upsteam 加错了,仔细看指南。

@hailinsu
Copy link

hailinsu commented Dec 3, 2019

如何把之前你用的本地学习用书备份,然后删掉原本的 fork

@neolee
Copy link
Owner

neolee commented Dec 3, 2019

@hailinsu 1. 如何备份自己电脑上的一个目录?如果以后还想打开用,换个名字就行,比如把 pilot-student 改名为 pilot-stident-s1 就好了。2. 如何删除一个 GitHub 中的 repo?这个...自己搜搜就好了吧?

@hailinsu
Copy link

hailinsu commented Dec 3, 2019

@dfdssgb 百度搜一下就可以找到答案

@zhenrany
Copy link

zhenrany commented Dec 4, 2019

@neolee 已经处理好,谢谢!

@johnxie1225
Copy link

捕获
zui最后一步的时候显示 err 不知道哪里出错了~~

@Shawnnn
Copy link

Shawnnn commented May 23, 2020

image
已经进行了commit保存了自己原有的设置,但是最后一步git push, permission denied, 访问被拒绝

@neolee
Copy link
Owner

neolee commented May 24, 2020

@Shawnnn 你没有权限 pish 给我的仓库,那当然就 deny 了啊。你要先 fork 我的仓库使之成为你的,然后 clone 到你的计算机上,然后修改提交再 push 给你 fork 的仓库。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspiring Inspiring question and/or answer
Projects
None yet
Development

No branches or pull requests

7 participants