February 19, 2014
Decide who in your group will write code first. They will be the owner of this repository (but don't worry, you'll both have a copy of it at the end!).
We're going to set ourselves up to use git properly for the rest of this guide.
On GitHub create a new repository (git project names are usually writen like your-project-name
).
On your computer open terminal or command line and move to your programming directory. (This is a great time to create one if you don't have it already! It helps keep all your programming bits and pieces together.) Here are some handy hints for working in the terminal or command line.
Once you've navigated to your directory run the command git clone git@github.com:[your-github-username-here]/[your-project-name-here].git
Move into your new your-project-name
directory.
The repo owner needs to give the other group members access to the repo.
your-project-name
directoryNow everyone can continue working on the exercise on their computer.
Once you feel like you've made progress on your code, you should commit your changes locally, then push them up to the repo on GitHub. In the terminal, from within your your-project-name
directory, run the follow commands:
git add -A
git commit -m "write your message here"
git push origin master
Now you can see your code at https://github.com/[your-github-username-here]/[your-project-name-here].
After anyone has committed changes to their local repo you can push
those changes up to GitHub. In the terminal, from within your your-project-name
directory, run $ git push origin master
. If you go to https://github.com/[your-github-username-here]/[your-project-name-here] you should see your updated code.
After anyone has pushed to your shared repo you can pull
down the changes to your computer. In the terminal, from within your your-project-name
directory, run $ git pull origin master
- you should now have the latest code on your computer
When you're all done with an exercise you can fork the repository. In usual programming groups you probably wouldn't do this. However since you likely want permanant access, even if your group members delete their repos, you should probably make a fork so you own a copy of the code yourself. Just do step 1 from these directions, and you'll have the repo listed under your name too.