我发现了一些类似的问题,但它们与我在这里需要的略有不同。我正在学习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/