DEV Community

Cover image for Important commands of git(Version Control System) every developer should know
Aditya Patel
Aditya Patel

Posted on

Important commands of git(Version Control System) every developer should know

1- git init = used for initializing empty repository.
2- git status = used for checking the current status of the repository(recommended-must after very usual operation performed in git environment)
3- git add .= used for adding the files in git staging area.This area contains a list of all the files you have recently changed.
git commit -m"Initial commit"= This involves committing them locally to record the snapshot of your repository to the project history.
4- git remote add origin url of the remote repository= for linking the files of local repository with remote repository.
5- git push = to push the the local repository on github.
6- git checkout -b aditya= to create new branch and use it to upload files in a initialized repository
git branch -d aditya = to delete the branch
7- git merge= The "merge" command is used to integrate changes from another branch.
8- git log =The git log command shows a list of all the commits made to a repository.
9- git pull =git pull is a Git command used to update the local version of a repository from a remote.
10- git restore --staged index.html= to remove file from staging area.
11- git restore index.html= to discard changes done in file.
12- git push -d origin bugfix = before deleting any branch merge it with master branch to keep your work safe.
13- git branch -r = to checkout branches in remote
14- git branch -a = to check all branches.
15- git commit --ammend = vs code will open to change the message of commit.
16- git rm -r --cached bin/= all files present in the directory will be unstaged/removed.
17- git switch -adi = new branch with the adi name created.

Image description

Top comments (0)