TOP 20 GIT COMMANDS YOU SHOULD KNOW!!

disha saxena
2 min readFeb 4, 2022

Git is a free and open source distributed version control system .
It is designed to handle everything from small to very large projects with speed and efficiency.

GIT workflow

GIT Command-Line Fundamental

1. git branch <branch name>
: creating a new branch
2. git checkout ‘<branch name>’
: switch to a new branch
3. git status
: to check the status of that branch
4. git branch
: to check the current branch name
5. git add -A
: to add everything into the current branch/add all the changes
6. git commit -m “write a message”
: to commit the changes
7. git push -u origin <branch name>
: push the changes to remote repo after commit
8. git checkout master
: switch to master branch
9. git pull origin master
: pull all the changes for up-to-date the branch
10. git merge <branch name>
: merge the local branch with the current branch(master)
11. git push origin master
:then push all the changes to master branch
12. git branch — merged
: shows the branches that have been merged so far
13. git branch -d <branch name>
: to delete a branch locally
14. git push origin — delete <branch name>
: to delete a branch from remote repository
15. git branch -a
: command to see all of the branches.
16. git diff
: shows the changes made to the code
17. git remote -v
: list the information to the repo, like location etc
18. git reset
: to remove all the files(everything)from the staging area.
19. git log
: it gives the hashnumber of the recent commit we did
20. git init
: to initialize a repository from an existing code/create a new blank repo

To set config values after installing git:

git config — global user.name “<your name>”
git config — global user.email “<your email>”

--

--