GIT Basic Concepts

Avishek Barnwal
2 min readMar 21, 2021

#

Purpose of GIT:

1. It is a version control tool used to maintain our Project version

2. Undo Mistakes: Here we can revert back to older version if new version is having some mistakes i.e provides the feature of undo mistakes

3. Distributed Development : Here it can handel multiple parallel development for a single larger project

4. Dont mix things : here we can make multiple branches to distribute multiple tasks in different branches and then if need merge them.

NOTE: The branches that are created will work completely separately until we merge them with the parent / master branch.

5. Community Support : There is a huge community support for GIT

#

Important commands for git :

1. git init :

To initialize a new git repository for a new or existing project and currently we are in the master branch

2. git add <file name> :

File name that needs to be added in the git version control system. This will basically add the files to the staging area , from where later the files can be commited using the git commit. And after adding the files to git then only tracking of the files or the project will be started.

3. git status :

It lists the files that are being changed and the files that are yet to be commited i.e displays the current status of the project

4. git commit -m "commit_message" :

Making a commit basically creates a checkpoint for our project and add it to git repository in our local system i.e whenever we think we need to revert back in our code then we can reach the code present in this checkpoint. It also helps to track the changes that we made to our project through the message that we can write while commiting.

5. git log :

It basically gives us all the information about the project like the number of commits made , master branch name and many more such kind of information.

6. git rm --cached <file_name> :

It helps to remove the file from the staging section like if we want to make some more changes to file before adding it to git using the git commit. Hence we have to revert back from adding the file to the git, therefore to do this the above code is used.

7. git branch <new_branch_name> :

--

--

Avishek Barnwal
0 Followers

Hello Guys, I am a Computer Science Engineer with Industry based knowledge in MERN Technologies.