DEV Community 👩‍💻👨‍💻

Billy Okeyo
Billy Okeyo

Posted on • Originally published at on

Introduction to Git Commands

If you are developer then you have probably come across this terms, git and Github. You might already have some idea on it and don't know how to make full use of this tools or maybe you are an absolute beginner who doesn't know anything about these. Worry not.

In this article I'll expose you to git and github, what each does and how you can use them to enhance your productivity as a programmer.

So let's get started

What is Git

Git is a version control system which is free and open source.

Version control is the management of changes to docs, programs etc. It's helpful in a programmers life since through it you can track all your code changes etc.

What is Github

Github is the website you use to host your git repositories.

Git Commands

clone - this is used to download a repository that is online into your local machine

add - this is used to track files and changes in your code.

commit - this is used to save your files in git

push - this is used to upload git commits to your remote repository of choice like Github

pull - this is used to to download changes of your remote repo to your local machine.

That's all the commands we'll cover in this series. Don't worry if you have not understand what those commands do, we'll get to do them practically so that you understand well what each command does.

I'm assuming you already have an account in Github, if not create an account, it's straight forward and easy to get started with github. Create an account here if you don't have an account then follow along.

If you have an account login into your account and you will be greeted with with this screen.

In this screen you'll see a green button written New. This button will create a repository.

Repository is basically a project. If you have a project it will be saved in a repository of it's own so you will have different repository or repos for different projects you have.

Clicking on the new button will open another page where you'll be asked to input your repo's name, after that you'll see other options like description, public, private, initialize with a readme etc.

Now if you want your repo to have a description like what project are you going to have in that repo, what it does etc, you will have all that in the description.

If you want to make your repo public so that anyone can see it, you will want to click on public button, it's always selected by default so you can just leave it as it is.

If you want to make your repo private, only you and people you allow will be able to see your repo then click on the private button.

Initialize with the readme is used when you want to create your repo with an already readme file. You can choose not to select this and add the readme file on your own the choice is entirely yours.

Add gitingore is used when you want to have certain files in your project that you want to ignore when pushing into Github, basically such files might have sensitive information that you don't want to get into wrong hands then you'll use the gitignore file

Add a license is used when you want your project to have like a licence file that protects it from copyright issues.

Now that we have all that sorted out we can now proceed and click on Create Repository button. It will take less than some seconds and another screen will open up where it shows some quick setup instructions on how you can add files to your repo.

Hope you had fun and learnt something in this article. I'll stop there and in the next article we'll now get into creating files and pushing them into Github.

Have fun and don't forget to hit on that upvote button if this helped. See you in the next article

Top comments (0)

Super Useful CSS Resources

>> Check out this classic DEV post <<