Using github collaboratively
I figured a brief overview on how to clone, commit, and push would be nice .
First of all you need to be added as a contributor in order for you to push your updates to the repository on an account.
1) Create a directory to store the project, this will become the root of the files that you can later push onto the github server.
2) From within the new directory, clone the project using:
git clone https://github.com/username/Project.git
3) Make changes at your leisure to the project.
4) Once you’re ready to update the online repository you must first add any new files you’ve created and want added to the repository by running:
git add filename
5) Then to commit your changes run:
git commit -am “Message of your choosing”
6) After you have committed changes and are ready to add them to the repo for everyone to use first setup a git remote (only needs to be done once I think) by running:
git remote add origin https://github.com/username/Project.git
7) Finally push to the master branch on the server where you’ll be prompted for your username and password with:
git push -u origin master
8) This guide ignores merge conflicts where if two people are working on the same code, and change the same line of code and then one pushes the change before the other. The latter will get an error. So it’s important for you to work synchronously or at least agree to work on specific areas of the code.
That or you can get into git fetch and git merge (run together with git pull) which does it’s best to merge the code, if there’s a merge error it’ll show you the differences within the affected file which you’d have to change appropriately.
After step six and before step 7
6.1) Call git pull to ensure there are no merge conflicts
git pull https://github.com/username/Project.git
6.2) If there are errors, edit the afflicted files in all marked merge conflict spots in the code. Use git diff to see where and in which files and the code from either party:
goto step 6.3)
goto step 7)
6.3) After fixing the merge errors goto step 6.1 to ensure no changes have been made in that time.
http://gitref.org/ for more information