How to install Git on Mac

By:, On:

Very soon after we start writing code, we will come to the point where we would like to "go back in time" and rewrite some of that code. But the question is: how do we manage the history of our code, as it changes? Also, we may want to collaborate with some people and share the code in the future. How can we manage our code then? The answer is simple: we use something called a source code management system. Probably the most popular one is called Git. If you don't know what source code control is, just think about it as a "quick save" from a video game. You're sneaking up on some enemy,and you're afraid that things could get rough so you want to save the game state before you make the move. Git works in a similar way, but it allows you to do much much more. But for now, we will only use a couple of the very basic features.

Step 1: Download and Install Git

First things first, we need to download and install Git on our machine. If you're on Linux or Windows you can go here:

If you're on Mac you can use a nice installer. Download and run it.

If you're on Mavericks you may see the following warning:

This is because of some new security "improvements". Click on the installer file with the right button and select open with "Installer"

That's it. Git is running on your machine. We can now navigate to our project and start tracking the code.

Step 2: Track Code

In the Terminal, navigate to your project and run:

$ git init

Initialized empty Git repository in /Users/Lukasz/Documents/Projects/demo/.git/

Now we will add all the code that is already inside of the folder:

$ git add .

And perform the save:

$ git commit -m "Initial commit"

Inside the quotes we have to leave a message. Later, when we browse the commits we will see those messages and be able to quickly find the commit we want to check out, so remember to be descriptive when you write your commit messages.

If you login you will be able to mark this tutorial as finished to track your progress


  • On: Frank wrote:

    This is straightforward and useful. One comment, when I started reading this I was logged out. When I logged in to comment it dropped me back on the main page. Could that be changed?
  • On: Frank wrote:

    I just rated this but it showed up as rated "0%" which was not my rating. FYI, thanks!
  • On: Lukasz Muzyka wrote:

    Thanks for the comment. I have deleted the score, you can try submitting it again. I will debug the problem. Also, I will change the redirection after login - very useful comment.
  • On: Sam DeBrule wrote:

    All lessons have been great so far. One suggestion: Can you auto navigate user to the next step within a lesson once they click complete? Currently, I have to navigate to Learn by Building > Appropriate Lesson > Next Step
  • On: Lukasz Muzyka wrote:

    Dear Sam, Yes - We're working on polishing some features and the flow. We should have something more user friendly next week. Thank you very much for the suggestion. We also want to implement features like notifications, so you can get email that I have replied to your comment. The thing is, I want to build tutorial about implementing that feature as I do it:) - which takes a little more time.


You can login to comment