Git and GitHub

All developers will use some kind of version control system (VCS), a tool to allow them to collaborate with other developers on a project without the danger of them overwriting each other’s work and rolling back to previous versions of the code base if a problem is discovered later. The most popular VCS (at least among web developers) is Git, along with GitHub, a site that provides hosting for your repositories and several tools for working with them.

Overview

  • It is rare that you will work on a project completely on your own, and as soon as you start working with other people you start to run the risk of conflicting with each other’s work — this is when both of you try to update the same piece of code at the same time. You need to have some kind of mechanism in place to manage the occurrences and help avoid loss of work as a result.
  • When working on a project on your own or with others, you’ll want to be able to back up the code in a central place, so it is not lost if your computer breaks.
  • You will also want to be able to roll back to earlier versions if a problem is later discovered. You might have started doing this in your own work by creating different versions of the same file, e.g., myCode.js, myCode_v2.js, myCode_v3.js, myCode_final.js, myCode_really_really_final.js, etc., but this is really error-prone and unreliable.
  • Different team members will commonly want to create their own separate versions of the code (called branches in Git), work on a new feature in that version, and then get it merged in a controlled manner (in GitHub we use pull requests) with the master version when they are done with it.

VCSs provides tools to meet the above needs. Git is an example of a VCS, and GitHub is a website + infrastructure that provides a Git server plus a number of really useful tools for working with git repositories individually or in teams, such as reporting issues with the code, reviewing tools, project management features such as assigning tasks and task statuses, and more.

Prerequisites


To use Git and GitHub, you need:
• A desktop computer with Git installed on it Git – Downloads (git-scm.com)
• A tool to use Git. Depending on how you like to work, you could use a Git GUI client
(we’d recommend GitHub Desktop, SourceTree, or Git Kraken) or just stick to using
a terminal window. In fact, it is probably useful for you to get to know at least the
basics of git terminal commands, even if you intend to use a GUI.
• A GitHub account. If you haven’t already got one, sign up now using the provided
link.

Leave a comment

Your email address will not be published. Required fields are marked *