2

I found some similar questions but they are slightly different from what I need here. I am study the mit6.828 jos course. For the lab section. They use their own repo to distribute and track lab code. They have few labs, which is build one upon another. I cloned the lab repo to my local disk. I want to track my progress in my github repo. I wan't able to push the untouched folder to my repo.

My question is how could I use my github to track my progress to the lab1, and later update the repo to lab2, and keep working on it and so on. I found this thread, Cloning a repo from someone else's Github and pushing it to a repo on my Github, but it seems not work as I needed. I also find this help document from github, I think they are related solution, but I don't quite understand. Anyone can understand it please help.Thank you.

Community
  • 1
  • 1
Harry
  • 63
  • 1
  • 10
  • Can you refine the question about what you actually need? – uday Mar 05 '14 at 22:09
  • Are you taking a course at MIT? Are there any faculty members there who could help you? Are of the of repos public? If they are public, may we have links so that we may take a look? –  Mar 05 '14 at 22:13
  • here is the lab1, and lab2 http://pdos.csail.mit.edu/6.828/2012/labs/lab1/, after clone the lab1. I want to keep it in my github repo, I would modify files in it. After I finish the lab1, I want to merge with the lab2 assignment. the checkout command is given as 'git checkout -b lab2 origin/lab2' and 'git merge lab1'. then solve lab2 and keep it update to my github. – Harry Mar 05 '14 at 22:33

2 Answers2

2

You can do like this:

# 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

When lab3 becomes available, you can just repeat the steps from git fetch origin.

Let me know if any of these steps is not clear enough.

janos
  • 120,954
  • 29
  • 226
  • 236
0

Your question sounds like it should be solved by the answer you link to, but here's a simple example:

# Add your repository as a remote
git remote add myrepo https://github.com/me/myrepo

# Update from the MIT repository
git pull origin

# Push to your repository
git push myrepo

Basically you're just specifying whether you want to pull from (or push to) your repository or the MIT one.

Update If your new labs are added as branches to the remote repo and you want to merge your changes from lab1 into lab2 you can do this:

git branch --track lab2 origin/lab2
git merge lab1 
git push myrepo
spikeheap
  • 3,827
  • 1
  • 32
  • 47
  • I tried multiple times, it seems worked. But how can I update to the lab2, which given by command ''git checkout -b lab2 origin/lab2''' and '''git merge lab1''' – Harry Mar 05 '14 at 22:35
  • `git checkout lab2` should update you to the new lab. If they've got common bits then the `git merge lab1` should be fine, and then you can push to your repository. Doesn't that work for you? – spikeheap Mar 05 '14 at 22:41
  • Any pointers as to what's not working? It's hard to help without error messages or information :) – spikeheap Mar 06 '14 at 09:12