Essential Git Commands



This content originally appeared on DEV Community and was authored by Cinthia Barbosa da Silva

In this post we will learn the basic and essential commands of Git that developers use in their daily lives!

Let’s go!🚀

Settings:

To set the global username

git config --global user.name "username"

To set the global email:

git config --global user.email "user@email.com"

Basic Commands:

To initialize a git repository

git init

To clone a repository

git clone <URL>

To check the changes

git status

To add a file

git add my-file

To add all changed files

git add .

To commit your changes

git commit -m "my first commit"

To push changes to the current branch

git push 

To update your branch with changes

git pull

To switch branches

git checkout develop

To update your local repository with remove changes

git fetch

To create a new branch

git branch my-new-branch

Essential Command to Merge and check log:

To merge a branch

git merge my-branch

To check log

git log

To revert a commit

git revert 001

This is for today! If you have any questions, leave me a comment!

And you found this article helpful, please like the post.❤


This content originally appeared on DEV Community and was authored by Cinthia Barbosa da Silva