First, the reason we are using GitHub is because it makes it so much easier to work in teams! It minimizes the chance that any one change breaks the project. It also allows you to see what other people have been working on. There's a bit of a learning curve but you really only need to learn a few commands to be successful.
Repository
is like a folder! It collects all of your work for a specific project.Clone
ing a repository is like copying it.Pull requests
are a way tomerge
your changes into arepository
- You can also
pull
changes into your branch before youmerge
to prevent some error messages - You can
commit
local changes and thenpush
them to your branch on GitHub
-
Navigate to the folder you want from github. For example, if you wanted to work with the
mac-share
repository, you would go here. -
Your screen should look like this!
-
To get all of the files, you'll need to
clone
the repository (copy the repository). Click the greenClone or download
button in the right-hand corner. -
Click the
copy to clipboard
icon (or just copy the url). -
Navigate to your terminal (Mac) or command prompt (PC)
-
Choose where you want to put this file. On my PC, to save it in my Documents folder, I type
cd Documents
. -
Type
git clone {url}
, but replace{url}
with what you just copied. -
Congrats! Now you can edit the files on your computer.
-
In your command prompt/terminal, navigate to the correct folder. If you're on a Mac you can see where you are if you type
pwd
(personal working directory). The PC equivalent iscd
(current directory). -
Type
git remote add origin {url}.git
. Replace {url} with the repository url from your internet browser. -
Now you need to add your own branch! The
master
branch should only be where we put our polished work, to keep things clean. To make your own branch, typegit checkout -b {name}
. I recommend using your first name as the name of your branch. -
If you're ready to
push
your changes, typegit status
to check which files you're about to move. It's good to spot check just in case something is included that you didn't mean to have. -
If everything looks good and you want to commit all the files, type
git add .
to add everything, then typegit commit -m "{message}"
, replace {message} with a quick description of what you're pushing. -
To push everything (last step!), type
git push -u origin {your branch}
(in the future you should be able to just typegit push
). At first it will say "fatal HttpRequestException encountered." Really, it's just prompting you for your username and password to make sure you actually have write access to the repository. -
If you get an error saying something along the lines of your branch is behind, try typing
git pull
to merge any remote changes you may have made.
Please do not change anyone else's working branch! It can cause problems and is a pain to fix sometimes.
For now I'll be only person who merges pull requests to the master branch while everyone gets used to GitHub. If you want to submit your pull request (merge your branch with the master branch), let me know! I'll give you more detailed instructions.