Working with git for noobs

aps08
3 min readJun 6, 2021

--

Git, git bash, or version control you must have heard one of these terms if you are a techie. Now, if you have only heard about these terms, and don’t know how to use git, then this article is for you. In this article, I will try to explain git, git bash, version control, and some frequently used git commands in simple words.

What is git and git bash ?

Git —Git is software used to keep track of changes made in a repository. By Using git we can revert back to the previous version of the project if the present version meets with a problem.

Git bash — Git bash emulates a bash environment on windows, we can use git commands in it with most of the standard Unix commands.

What is version control ?

When multiple individuals work on the same repository, then it’s hard to keep track of changes. Here git helps us keep all those changes by keeping the configured username, email, and message on each commit.

Setting up git on your system

You can download and install git from here. Now type “git — version” in git bash or CMD to check if git is properly installed or not. If git is installed properly you will get the version of git as an output.

Working in a local repository

Before working with the local repository we need to config username and email for git. For this we have 2 option:

Global configuration: It will configure username and email for all the repositories in the system and we need not do it again.

Local configuration: It will configure username and email for the present working repository. This needs to be done for every repository and after initialization.

Now if you have selected the type of configuration you want( I always prefer the global configuration ). Let’s get started. Create a folder anywhere in your system and add some files in it and open git bash there and follow the commands given below:

Other useful commands:

Pushing local repository to GitHub

We will be using SSH, so before we push our local repository on GitHub we need to add a public SSH key to our GitHub account. To do that open git bash and follow the commands given below:

Now we are all set, go to the repository you want to push and initialize, set configuration, add all files to git and commit changes. (I have explained how to do this in the “ Working in a local repository ” section)

Now go to your GitHub account and make a repository manually without adding any file. Click on the code button on the top right side of the repository and copy the SSH link which would look like “git@github.com:githubusername/githubrepositoryname.git”. Now follow the commands given below:

Thank you for reading this article “😊😊😊😊”. Of course, there are many more commands you could use with git which I would explain in my upcoming articles. You can read more about git in-depth here. If you like this article give me a clap and feel free to connect with me on Github, Twitter, and LinkedIn.

--

--