Let’s Git Started

Ian Rosen
3 min readJul 26, 2020
Font Awesome Free 5.4.1 by @fontawesome — https://fontawesome.com / CC BY (https://creativecommons.org/licenses/by/4.0)

When I first started coding, about five to six months ago, I felt overwhelmed by the sheer amount of information that is out there. I quickly learned to live by the mantra, “You don’t know what you don’t know.” This mantra has driven me to pursue numerous changes in my life, at the forefront of which is a Software Engineering Bootcamp at the Flatiron School in New York City.

Before I even applied to Flatiron, I was looking for new ways to expand my knowledge in the world of computer programming. There are so many languages out there, how do you know where to start?

One concept that I found that seems constant across all worlds in the computer programming universe is version control.

“What is version control,” you might ask. Version control is what allows you to keep track of changes that you make to your work. It allows you to share your work with coworkers, and also allows them to make changes without affecting whatever you are working on. Does it sound too good to be true, yet? Well, you better believe it.

As you might have guessed by the title of this post, I’ll be talking about Git — one of the most popular version control systems out there today.

To get started with Git, you’ll need to first create a directory on your computer where you will be keeping your project. Next, type ‘git init’ into your terminal. This will initialize a new repository for you in GitHub. Next, ‘git add .’ will add all of the files and changes to be committed. Be sure not to forget the ‘.’ otherwise you’ll need to type out the file name of each file you would like to add. We’re nearly there! After you add the files, you will need to commit them with git commit. Best practice dictates that you always commit with a message, especially if this is your initial commit. To do this, type ‘git commit -m “-Your message here-”’ into the terminal. If this is your first/initial commit, your message could look something like “first commit” or “initial commit.”

The next step is to connect this new directory to an empty repository on GitHub. Log into your GitHub account and click the “New” button in the upper left-hand corner of the page. Give the repository a name and an optional description. Best practice is to not initialize with a README, gitignore or a license. These can all be added later. Click ‘Create Repository.’

Next, you’ll need to copy the ssh key to your clipboard and follow the second set of instructions that say “…or push an existing repository from the command line.” They are as follows:

‘git remote add origin <ssh key goes here>’

‘ git push -u origin master’

Once you have type those commands into your terminal, you should be good to go! Congratulations on creating your new Git repository!

--

--

Ian Rosen

Software Engineer with passions for education, wildlife conservation and travel.