2011-05-03, 22:15
Reading up on something new can be really boring and tedious (I attempted PHP recently!) - and if you dont understand it from the off, frustrating. You may just want to use this as a reference for the basics of using Github.
I'm going to try to make this as plain and simple as possible (and hopefully short).
It assumes you Putty into a Linux OS or XBMCLive. All commands would require 'sudo' in front of them.
If you use Windows only, still read this guide as it will give you a good understanding, then use this guide to install and use Github in Windows.
My Perception of Github.
I say perception because I may be wrong in places.
Github is a coding community where people share code (or ideas) for a project to help make it better or in MFP's case, to add further features.
Editting online on Github.
Lets suppose we commit (or change) a html document some else has made an error with...
Code:
<HTML>
<HEAD>
</HEAD>
<BODY>
Hello Worlld
</BODY>
</HTML>
The easiest way is to do this minor job on Github itself. Once your logged in and have permission to edit the Repo (or it is YOUR repo) there is an Edit button. You click it, make the change (add the comment at the botton) and click Commit.
It simply changes the file, updates it and corrects the typo - but it only adds the changes you made and NOT the entire file (unless you completely rewrote it, whereby Git would know you have).
Every change you make to any file will require a comment to explain what you did. In this case -
"Corrected the word 'Worlld' because someone can't spell"
would be a good, sarcastic comment.
Once you press Commit, you have made a change to that code and it gets a unique Commit ID - this makes it possible for that Commit to be retracted in the future if need be. If it does, the only thing that will be changed (as long as it's not changed too much since) will be the typo.
That concludes the easy section of understanding editting on Github itself.
Editting offline away from Github.
When logged into Github can Fork (Copy) any repo and it will be cloned to you and your login details. If you clone MediaFrontPage your repo will live at http://github/USERNAME/mediafrontpage.git.
Creating a Fork is also known as a branch if I understand correctly, branches (or forks) from the original repo owner can be monitored by them and if the changes are uploaded (pushed) to your fork, the original repo owner can merge the changes into the Master. Ultimately, the changes you made to anything will be available online for all to view or try from your fork. If the fork proves cool, it can be added to the original master (I'm not sure how it's done, I'm hoping Gugahoi does! )
Once you have forked the repo, you can download (clone) the repo to you machine to be edited how you see fit - add features, change things, break things - whatever. BUT, any changes you make are optional when it comes to reuploading (push) them.
Once you have made the changes, you can do a 'git status' and it will compare your changes to the original repo and tell you what files have changed.
If you have a few files that have changed you can specify them from the list you just created with 'git add filename.ext'.
These are all added to the staging area (being ready to upload the changes to the files online, remember, it only uploads the changes unless you completely rewrote the file). If you have a new file - for example a new.css file. You would do this the same way - 'git add /css/new.css" and it will be included in the push.
Now, once the changes are in place and all the files you want added are in the 'staging area', and your happy with the changes and everything still works as you expected, you type 'git commit -m "Here is my comment about what I just did"'.
This will then commit all your changes in the staging area and give Github a comment to add for your commit your about to do.
Now your happy with the changes, everything is cool and ready to upload type 'git push'. It will then ask for your github login password, just to be certain you have access to it and then upload all your changes with your edits to your online repo.
Congrats, if you got this far, any changes you made have been uploaded ready for the world to test or edit.
I would suggest creating you own fork of the MediaFrontPage Repo from Gugahoi and test it out a few times til you understand it, use this as a 'beginners' guide.
If it does go all pearshaped, because it's your repo, you can delete it on Github and Fork it from Gugahoi again from scratch!
Github is like a Social Network for coders and the Network tree for MediaFrontPage (or timeline and branches made) can be viewed here - https://github.com/nick8888/mediafrontpage/network
Once you make a fork from it, your username will also be added to it - I suggest forking from Gugahoi as he is furthest ahead, you can see where I edited the Readme.md today with loads of commits to get it right along the bottom.
Hope the information above is right. If not - tough (jokes), I'll edit it and make it right. But it should get you on your way to learning about Git.
Any questions, try not to fill the thread to much, PM me!