Git - Command You Should Know

Β·

2 min read

Git


Git is the distributed version control system that helps developers to collaborate on a certain project on any scale.

Distributed Version Control System

It is a system that helps you to keep track of your project files, and changes that you have made in your project.

In this, every developer has the full backup of the project on its local machine and can revert back to the previous version of the project.

Git has various different commands which we can use, I have mentioned a few of them which are frequently used.

Configure the git:

git config --global user.name "your_name"
git config --global user.email "your_email"

Initialize the git

git init

Check git status

git status

Adding in staging area

git add .

In the above code dot(.) is used to target entire file else you can give the specific file name which you want to add in staging area

Commit the changes

git commit -m "message"

In the above code -m is the flag for message

To Check logs

git log

or

/* --oneline = Give you the logs in one line  */
git log --oneline

Delete the git repo

rm -rf .git

Skip the staging area

/* -a = add ,-m= message */
 git commit -a -m "commit_message"

To see the changes which you have made in the file

git diff

To see what you have staged in next commit

git diff -- staged

Thank You πŸ˜€

Β