Getting started with Git

Created December 4, 2020


Whether you are a newcomer to programming, or an experienced one, you have to know how to use Git. Most of the projects that a small or big group of developers work on are done through GitHub or GitLab.

It makes working with other developers so much more exciting and enjoyable. Just by creating a new branch, adding all your brilliant ideas to the code that can help the project, committing it, and then pushing it to GitHub or GitLab. Then after the PR(pull request) has been opened, reviewed, and then merged, you can get back to your code and continue adding more awesome stuff. After pulling the changes from the main/master branch, of course.

If what you just read doesn't make any sense to you, don't worry. Everything will be explained in this post!

This post will show you the basics on how to start using Git and try to help you get more comfortable with it. It does look a bit scary in the beginning, but don't worry. It's not as frightening as it seems, and hopefully, after reading this post, you can get a bit more comfortable with Git.

GitHub Flow

If you are wondering what the GitHub flow is, just go back to the Introduction. We already explained it. It goes more or less like this:

git clone <reposatory URL>
git checkout -b <branch-name>

If your branch name has multiple words, they have to be separated with a dash (my-first-branch)

git add <branch name>

If you want to add all of the files, then write 'git add .'.

git commit -m 'descriptive message'

The '-m' is a flag for a message to set the commits with the content where the full description will be included

git push origin branch-name
git merge branch-name
git pull origin branch-name

So this is The GitHub Flow and the main commands you will use. It may seem complicated at first, but after going through it a couple of times, you will get used to it.

Helpful Git commands

There are quite a lot of useful Git commands out there. They are super helpful, and you are probably going to want to use them all the time. Here is a list of a few of these commands:

git diff
giit status
git rm branch-name
git log
git branch


Learning Git is essential for every programmer. Even some of the biggest companies use GitHub for their projects. Remember that the more you use it, the more you're going to get used to it.

I hope that this post has helped you understanding how Git works, and I hope you create some amazing things using it.