Mostly used git commands for beginners
Tags: git, developers, beginners, cli
Published: 2021-01-13 18:25:07

---
title: Mostly used git commands for beginners
published: true
description:
tags: #git #developers #beginners #cli
//cover_image: https://direct_url_to_image.jpg
---

Git is a magic bullet for developers to track your work. Git also differentiates the other teammate work by using git commands. Here are the 10 most used git commands.
1. **git init**
2. **git clone**
3. **git add**
4. **git status**
5. **git diff**
6. **git commit**
7. **git push**
8. **git pull**
9. **git revert**
10. **git checkout**


`git init`

Git init is used to initialise the git to a local repository. But when are you clone from remotely then you don't need the git init.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wo1e51b0q2ufza6r7ddd.png)

`git clone [remote_url]`

Git clone is used to creating an identical copy of a Git Remote Repository to the local machine.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1qmkinblma340zxsedzn.png)

`git add [file name/.]`

Git add is used to add the modified files in the staged area. There are following ways to use git add, by adding the entire folder and specific files. Dot means the entire folder.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gtd2zajdf6fbat6yu043.png)

`git commit -m "Your message about the commit"
`
Git commit is used to add the changes with a unique message in an individual file or set of files. Git commits also creates a unique id. A "unique message" shortly describes what changes you have done. It also helps you track your commits.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hh4sz83wjm64ho0apnve.png)

`git status`

Git status is used to check the status of the modified files. It also shows which files are staged, unstaged, and untracked.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v60d4ix2t43g1mtl5x1r.png)

`git diff`

Git diff is used to track the difference between the changes made on a file.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/leln0db1x8uuyh1t1rh1.png)

`git revert [commit id]`

Git revert is used to undo the changes of the given commit which we have pushed in a "remote" repository and changes add in the current branch. Without losing your previous commit.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wzo6bjk8ueirz0e2ygxp.png)

`git push`

Git push is used to push all the changes locally to the remote repository.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qsnklluzmwsbfppxsjkk.png)

`git pull`

Git pull is used to pull all the changes from remote to the local repository.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wpndlyaeaqkc3x8g5btj.png)

`git checkout [file/branchname/commit id]`

Git Checkout is used to switch between files, branches and commits.
**Practice:-**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p5gb6or39af5gvnguni5.png)


**Conclusion**

In this article, I cover mostly used git commands for beginners. I also define the syntax, purpose and usage of command at one place. 
I hope this article help to learn git commands.