Git Commands Every Developer Should Know - Ultimate List

Git Commands Every Developer Should Know - Ultimate List

In this article, I write down a quick git commands cheat sheet, which will include commands that developers use every day

Here, we have listed some most useful git commands:

$ git init

Initialize a Local Git Repository

$ git add <file>

$ git add .

Add one or more files to staging area.

$ git status

Check the status of your current repository and list the files you have made changes.

$ git log

 Provides a list of all the commits made on your branch

$ git commit -m "commit messgae"

Commit changes to Index but not to the remote repository.

$ git push origin <branch name>

 Push the branch to the remote repository so that other can use it

$ git pull

 The git pull command fetches all the changes from a remote repository to a local repository

$ git clone

 The git clone Creates a Git Repository copy from a remote source

$ git diff

 View the changes you have made to the file

$git config -global user.name "your_name"

 This command tells Git who you are by configuring the author name

$ git config -global user.email <your_emailId>

 This command tells Git who you are by configuring the author email

$ git remote add origin <server>

 This Commands Connect your local repository to the remote server and add the server to be able to push changes to it

$ git branch <branch_name>

 The Git Branch Creates a new branch

$ git checkout <branch name>

 Using git checkout we can switch from one branch to another branch

$ git merge <branch name>

Using git Merge we can a branch into the active branch

To reset large merge before push

git reset --hard origin/dev

To checkout myBranch that exists remotely and not a locally

git fetch --all
git checkout myBranch

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

You might also like

Leave a Comment