Today, we're going to be talking about What is git?! Maybe you've heard of it, maybe you haven't. Maybe you've seen GitHub.com and wondered exactly what it does or who its for. — Well, today, let's talk about it!
git is a version control system.
It's not tied to any particular type of project, technology, or framework. You can use it if you're building iPhone apps, websites, or writing documents — it's really quite flexible.
All this really means is that it records every change you make to your project files.
Maybe that means something to you, maybe it doesn't. In normal people terms, it means
Still not convinced? Let me give you a couple of real world examples.
I did freelancing on my own for 7 years. I still used git on every single one of my projects, even though I didn't collaborate with other developers very often.
It provided a better workflow and it saved my butt a couple of times.
Let me show you the old way...
I would fire up Transmit, find the files that I had updated and drag and drop them over. — every time a change was made. I'd have to remember what files I had changed and sometimes go into multiple directories to find the changed files. — doable, but definitely a pain.
With , I make a change to a file. Then, I actually use a program called Tower and say, "These are the changes that I made" and it would automatically update my server for me! We can get more into that workflow later, but that might whet your appetite.
When working with a team, is even more awesome.
I've been building websites for almost 20 years. Right out of college, I worked at an agency. We would have to talk back and forth (ugh 😜) to make sure that the person sitting next to us didn't have the file we needed open. Otherwise, we'd end up overwriting each other and loosing the work.
Again, solves all of that. Furthermore, I can tell who made a change to file and talk to them about any questions I might have about their code — pretty cool.
To install on a Mac, it's pretty easy. Just open up your Terminal. — You can do this by going to Applications/Utilities or typing Terminal into Spotlight.
iTerm2 is pretty great too.
I'll include links in the description below.
These alternates just include a few more options and customizations that the generic Terminal that comes installed on your Mac.
Once you get your Terminal open, type and hit
If you don't have git installed already, a dialog will appear that says "The git command requires the command line developer tools. Would you like to install the tools now?"
Click Install and "Agree to the Terms of Service" when it comes up.
When it's finished, you can click Done.
The first time you're setting up git, there are a few configurations you'll need to set up:
If you want to make sure that it was entered and saved correctly, you can type
Same thing, if you want to make sure that it was entered and saved correctly, you can type
As a quick side note. If you want to set up the email address for a specific project, you'll use the same commands, except leave off the flag. So, it will just look like:
This just means when you make a commit, it will associate the commit with the correct person — And if you're thinking ahead, that means that you can tell who made a change to your project, what they did exactly and when.
You can use git through the Terminal, or a GUI (Graphical User Interface). In my opinion, its helpful to learn the vocabulary and the theory first, then, those concepts will transfer no matter what tech you use.
I'll include links to all of these within the description below.
VS Code is my editor of choice, so its pretty cool that they have an entire section of their app dedicated specifically to git. You don't even have to leave the code you're working on, you can do everything right there. — and VS Code is free.
Tower is my weapon of choice. I've been using it for years. When I started, there weren't as many options, or at least, not as many options that actually worked and looked good. Within the last couple of years, they've changed their pricing model, so you do have to pay for it every year, but its an app that I use everyday, for me its definitely worth it.
There are a few people that I work with that use SourceTree. It's made by the same people that make BitBucket, Jira, and Trello — if you've heard of those applications. It's free, which is a huge win. I don't have a ton of experience with it though, so I can't speak to the user interface.
I bet you can't guess who created this app. smirk. Yes, **GitHub created GitHub Desktop. This is another free app. The only downside is that you can only use it with GitHub. So, if you're working on a project that has code at BitBucket or GitLab, you'll have to use another application.
Sweet! I think you are now set up for success.
Receive a weekly email of the Internet's best from articles, to tutorials, to pro tips.