git - 将远程克隆的存储库推送到我自己的 github 存储库,保持其可更新

标签 git github

我发现了一些类似的问题,但它们与我在这里需要的略有不同。我正在学习mit6.828 jos类(class)。对于实验室部分。他们使用自己的存储库来分发和跟踪实验室代码。他们的实验室很少,而且是一个一个建立起来的。我将实验室存储库克隆到本地磁盘。我想在我的 github 存储库中跟踪我的进度。我无法将未触及的文件夹推送到我的存储库。

我的问题是如何使用我的 github 来跟踪 lab1 的进度,然后将存储库更新到 lab2,并继续处理它等等。 我找到了这个帖子,Cloning a repo from someone else's Github and pushing it to a repo on my Github ,但它似乎不能按我的需要工作。我也找到了这个help document来自github,我认为它们是相关的解决方案,但我不太明白。任何人都可以理解它,请帮忙。谢谢。

最佳答案

你可以这样做:

# clone the first lab into dir "course"
# note: the repository will be named as the "origin" remote automatically
git clone http://pdos.csail.mit.edu/6.828/2012/labs/lab1/ course

# do some work
git commit -m 'I made something...'

# add a remote for your repo on github and push to it
git remote add github YOUR_GITHUB_URL
git push -u github master

# lab2 is out, let's update origin
git fetch origin

# merge lab2 in your master
git merge origin/lab2

# do some work
git commit -m 'I made something...'

# push to github
git push

当 lab3 可用时,您只需重复 git fetch origin 中的步骤即可。

如果这些步骤中有任何一个不够清晰,请告诉我。

关于git - 将远程克隆的存储库推送到我自己的 github 存储库,保持其可更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22210382/

相关文章:

终端中的 Git

git - 将未提交的更改从 master 移动到分支

ruby-on-rails - Ruby Learning - 知道任何具有中等难度的 Ruby 代码的公共(public) repo 协议(protocol)吗?

macos - GitHub Mac 应用程序不断添加 SSH key ?

Git 更新主存储库中的子模块

java - 在 git checkout 之后在 eclipse 中包含文件

Git克隆一个已经是克隆的存储库

github - 如何查看我在 Github 上关注的所有问题?

Git 将 diff 分支到一个新的提交中

git - TortoiseGit 真的像 TortoiseSVN 一样让 Git 更容易使用吗?