Blog, Learn Tech Skills

Get started working with Git

Today, your goal is to get up and running with Git. You ready?

On Monday, we introduced you to every developer’s best friend: Git! Today, your goal is to get up and running with Git. You ready?

Once you start working with Git on your computer, then you can do fun things like join Github and start to collaborate with other Git-ers. Look out for more info on all that fun stuff coming on Friday.

Step 1: Install Git

Git has a fantastic guide all about how to get up and running with Git. In order to install Git you are going to need to use your command line (or terminal) tool. Before you dive into Git, review the key command line commands.

The key to using the command line is that you are going to be speaking to your computer directly with some very specific language. The good news is that when you write the wrong thing your command line will tell you and the other good news is that the Git install guide tells you exactly what to write.

Go get ‘em: Getting Started Installing Git

Step 2: Learn the top Git commands you gotta know

Using Git is actually quite easy, as long as you type the right thing. You are quickly going to find that there are really only ten or so commands that you are going to find yourself using 90% of the time. And here they are!

Once you have created the directory (folder) for your code and you are inside of that directory in the command line, try typing the follow commands:

git init
This command will create a git repository so you can get started!

git add .
This command is used to stage all of your changes, which means that you alert Git to the fact that you have made changes.

git commit -m “Your commit message”
This command tells Git that you have made changes and in between the quotes is where you tell Git what you did.

git push
When you are ready to share your changes with others, git push pushes the changes to a remote branch such as Github or a cloud hosting service for deployment.

git status
This command will provide you with information on the current state. You can see what files have been added, which are untracked, which are staged and which branch you are working on.

git diff
Before you stage and commit, this command will show you what you’ve changed in the repository. It is very useful for a sanity check before you commit your changes.

More good Git learning tools

Try Git
A great interactive Git learning tool made by Github and the Code School geniuses.
Learn about Git Branching
Git branching, visualized! Gain a better understanding of how Git branches work.