Using GitHub

GitHub is a place to store and manage code. It revolves around Git, a source control software that allows for fluid, collaborative work.

Now that you're all signed up for GitHub, and you have a repository for your code, there are some basic things you'll need to do to make sure that your code is being saved and kept up-to-date.

Open your GitHub application on your PC to manage code. You'll need to "clone" your repository in order to get the necessary files. Follow the instructions on the repository's web page, and place the repository in a folder that makes sense.

Once the repository is on your local computer, you can sync, edit, commit, and publish files.

Before you start editing, it's a good idea to sync. Just click the sync button in your GitHub app. This way, you know that you'll be working on the latest version of the files, and you'll be less likely to create a conflict.

Edit your files just like you would normally. The files are on your computer and behave just like normal files (because they are!). However, Git keeps track of changes and checks for differences between your files and the ones in the repository.

When you've made a significant change to your file(s), you should commit to the database. The GitHub app will show you files with changes. You have to leave a comment ("added images to slideshow", "fixed sidebar", "fixed typo in footer", etc.) before you commit. Once you put in your comment, the commit button will become active, and you can click it to commit.

When you commit your files, you are still only dealing with the local versions on your PC. To send them to the repository, you need to "publish" (Git also calls this "push") them. Click the publish button to push your committed changes to the repository.

Usually, that's all you need to do. However, sometimes there will be conflicts when you sync, commit, or publish. Git will tell you which files have conflicts, and you'll have to fix them.

Conflicted files will show both your code and the conflicting code from the repository, It's your job to clean up the mess, so you'll have to fix the files so that conflicts are resolved and the code is clean (get rid of Git's "<<<" characters, for instance).

Once you've resolved the conflicts, you'll need to commit and publish the fixed files.

Also, if you try to publish and Git tells you that your files are behind the master files, you'll need to sync and re-commit, resolving any conflicts that come up in the process.