Most used Git Commands You Should Know

Are you looking to improve your software development workflow? Git might be just the tool you need! As a version control system, Git helps developers track and manage changes to their codebase, collaborate more effectively with teammates, and ensure code quality and consistency.

By using Git, you can easily:

1 -Create and switch between branches to isolate changes and experiment with new features.
2 – Merge changes from multiple branches back into your main codebase.
3 – Roll back changes to specific versions of your code.
4 – Collaborate with other developers by sharing code and reviewing changes.

List of Git Commands:

Below is the list of some of the most used Git Commands along with a short description:

git Init:

This command is used to start a new repository. Git creates a .git directory.

git init
git init

git clone:

This command is used to obtain a repository from an existing GitHub repo.

git clone
git clone

git add:

This command is used to add a file to the staging area.

git add
git add

git add. : 

This command is used to add all the files to the staging area.

git add.
git add.

git commit:

This command takes a snapshot of the project’s currently stagged changes.

git commit
git commit

git diff:

This command shows the file difference which are not yet stagged.

git diff
git diff

git diff-staged:

This command shows the differences between files in the staging area and the latest version present.

git diff-staged
git diff-staged

git status:

This command shows all the modified files which are not committed.

git status
git status

git log:

This command shows the list of version history.

git log
git log

git branch:

This command shows all the branches of the repository.

git branch

git checkout:

This command is used to switch between branches.

git checkout
git checkout

git checkout -b:

To create a new branch and switch to that.

git checkout -b
git checkout -b

git push:

This command sends all the committed changes to your repository.

git push
git push

git merge:

This command shows all the branches of the repository.

git merge
git merge

git pull:

This command fetch and merge changes.

git pull
git pull

git stash:

This command temporarily stores all the modified tracked files

git stash
git stash

I hope you guys find this tutorial helpful. If you do please share it with your friends and bookmark this site for more amazing tutorials. Thanks

Leave a Comment