DEV Community

Cover image for All About Git and Github.
Pankaj Jangra
Pankaj Jangra

Posted on

All About Git and Github.

Hey there! Are you confused between Git and Github and want to know more about it? Then give this blog a read. I will try to provide all the details about it.

Let's get started....

What is Git?

Git is a version control system which is used for tracking changes in source code during software development process.
It was first developed in 2005.
Git is installed on your local machine so that you can use tools like Github, which uses the git mechanism.

What is version control?

Version control, as we can understand from the name itself, it is like controlling the versions of our project/software that we develop.
We can track and log the changes that we have made. It gives us the power to review them and we can even go back to the earlier versions that we have saved.

What is Github?

We can say that Github is a cloud-based tool which uses Git's functionality and provides us the built-in version control system.
We can share our code online on github, by making a repository on it. And also we can host our project on it by using its hosting service.

Commonly Used Git Commands

1. Git init

This command is used to initialize an empty Git repository. This can be probably the first command you run in a newly created project.
cd into the folder and run the following command:

$ git init
Enter fullscreen mode Exit fullscreen mode

2. Git status

This is a very helpful command. Sometimes you forget where you are on your git repo. So just run this command, this will tell you a lot of things like:
your current branch, what is committed, pushed or pulled, your branch is up to date or not and a lot more things.
Syntax:

$ git status
Enter fullscreen mode Exit fullscreen mode

3. Git add

Whenever you make any change to file, create a new file or delete any file. You need to run this command. It will add the files to the staging area but it will not make any change in the remote repository.
Syntax:
To add a single file:

$ git add <filename> 
Enter fullscreen mode Exit fullscreen mode

To add all the files (the dot is mandatory at the end):

$ git add . 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)