0

我正在参加一个有全班 github 存储库的课程来发布实验室、文档等。我想分叉这个,在实验室做我自己的工作,然后推送到我的私人 git 存储库。但是,我仍然希望能够从类 github 中提取更改。有没有办法做到这一点?

谢谢

4

2 回答 2

1

设置两个远程分支,一个用于您的私人,一个用于班级

git remote add classwide sshblah
git remote add private sshblah

那么你也能

git fetch classwide

抓住你的课件和

git merge localbranch

工作,然后你可以

git push localbranch private

将其放入您的私人仓库

于 2013-09-10T21:19:42.433 回答
0

是的,可以肯定的是,密钥在您的 repo 遥控器中,因此您的 fork 有一个名为“origin”的遥控器,并为原始 repo 创建一个名为 upstream 的遥控器。

使用以下命令创建上游远程

git remote add upstream https://github.com/user/original.git

然后验证你的遥控器

git remote -v
origin  https://github.com/your-user/fork.git (fetch)
origin  https://github.com/your-user/fork.git (push)
upstream    https://github.com/user/original.git (fetch)
upstream    https://github.com/user/original.git (push)

所以现在你可以从原始回购中推拉

git pull upstream branch
git push upstream branch

另一种方式,您可以直接在 Github 中创建拉取请求

于 2013-09-10T21:22:19.750 回答