I'd like to use the Git and GitHub programming tools on my Mac. Are they easy to learn?

Git, along with its popular web-based companion GitHub, sits alongside popular programming languages such as Python and Java as essential tools for the modern programmer.

Git and GitHub are versioning tools, used by developers to track different versions of the software they (and others) build. Git was designed in 2005 by the Linux Kernel team for Linux development, but it's since spread to all the key developers and all languages. Apple uses Git to track changes to its Swift development project, for example.

Git doesn't stand for anything; it mostly takes its name from the British slang word and the official GIT - README documentation refers to it as "GIT - the stupid content tracker."

See also: How to learn Swift online | Best Mac for app development

How to use Git and GitHub on Mac: What are Git and GitHub?

Learn Git on Mac

With Git, you track different versions of your code, which makes it possible to try out new ideas while keeping your original code safe. If the new code works, it can be merged into your current code, or discarded. Git is mostly used by code, but it can be used to track changes to text documents.

Perhaps more importantly, Git enables multiple people to work on code together. Changes can be made by individuals, and pushed to check. If the change is accepted, it can implemented by the main body of code. Git makes it much easier for people to work collaboratively on projects.

GitHub meanwhile is a website and hosting service. It uses the Git commands (and a few extra of its own) to store your code, and revisions, online. You use Git to push your code to GitHub, and it is stored (and shared) online in a space known as a "repository". You use GitHub to find code and projects by other developers, and can examine the code, follow projects and clone them to your local machine (and even contribute to projects).

GitHub is pretty popular, with 14 million developers using it and more than 35 million repositories.

How to use Git and GitHub on Mac: Setup

Install Git on Mac

To fully learn Git, you'll need to set up both Git and GitHub on your Mac. Both are long you've been programming, and what tools you've installed, you may already have Git on your computer.

Open Terminal and enter git --version. If you see git version followed by numbers, i.e., git 2.5.4 then you are good to go. If you don't have Git installed, then an alert will appear displaying "The "git" command requires the command line developer tools. Would you like to install the tools now?"

You have options here; one is to click Install and get the Command Line Developer Tools. The other is to install Xcode, which includes the Command Line Developer Tools. A third option is to click Cancel and get the latest version of Git direct from the developers.

Click Install Xcode if you plan to developer OS X or iOS software, if you want a hassle-free experience then click Install to get the Apple version of Git. Click Agree to the license agreement. Wait for the Downloading software alert to finish, and click Done. You should see "Git version 2.6.4 (Apple Git-63)". You're good to go.

If you're a serious Git user and want the very latest version then it's best to get it from the Git website:

  1. Open Safari and browse to the Git developer site.
  2. Click on Mac OS X below Downloads.
  3. Open the git-2.8.1-intel-universal-mavericks file in your Downloads folder.
  4. Double click the git-2.8.1-intel-universal-mavericks.pkg file.
  5. If you get a warning that says "“git-2.8.1-intel-universal-mavericks.pkg” can’t be opened because it is from an unidentified developer." Open Settings > Security & Privacy > General and click Open Anyway.
  6. Click Continue, Install and enter your admin password.
  7. Click Close.

Now open Terminal and enter git --version. You will see "git version 2.8.1".

Return to Safari and enter www.github.com. Fill out the "Pick a username," "Your email address" and "Create a password" fields and click "Sign up for GitHub". Ensure that the selected Chosen button is next to Free and click Finish sign up.

How to use Git and GitHub on Mac: Learning resources

Now that you've got Git and GitHub set up on your Mac, it's time to learn how to use them. Git is easy to learn (although it can take a lot to master) but with so many users there are a lot of tutorials to follow.

Here are some great places to go to learn Git.