Git CheatSheet
This article will give you basic understanding of git commands

Difference between Git and Github?
Git:-Gitis an version control tool
Github:- Somewhat Github is a web-based web hosting web service
Download
Download git from Git
git config
configuring user information used in all local repositories
git config --global user.name[firstname lastname]
git init
git initis used to initialize the git in our project it generates a folder with the name .git which stores all the information about the git stage and commits
git remote
git remote -vis used to get remote access for the Github repository
git status
git statusis used to check the status of our project, it helps us to track the stage/unstaged file/folder in the project
git add
git add filenameis used to add a particular file to stage and then to commit it in our Github repository
another way
git add . is used to add all the unstaged files to the stage so that we can commit them all at once
git commit
is used to commit all the staged files and folders
another way
git commit -am "message" is used to stage and commit in single command
git log
git logis used to check all the logs meaning it helps us to track all the commits by showing the history of the commit done in the project, it shows details like commit hash, time, date as well as the message with the commit
git rm -cached
git rm -cachedis used to unstaged all the stage files and folders meaning it helps us with removing all the files and folders from the stage
another way
git rm -cached filename is used to remove a particular file from the stage
git branch
git branchbranch name it is use to create a new branch in our Github repository
git checkout
git checkout branch nameit is uses to change / switch from one branch to another
git push
git push -u origin masteris used to push the commit to master branch
another way
git push origin branch nameis used to push from origin to a banch
git merge
git merge -am "message"is used to merge from one branch to other branch for Example ( main to master )
git reset
git reset -hard origin/masteris used to reset to last push commit
git pull
git pullis used to pull the files and folder from remote repository to local
About the author
I am FrontEnd Developer with around 2 years experience. I am currently working with Tata Consultancy Services. I have a strong comptency in HTML, CSS, JavaScript, VueJs, ReactJs
Comments
Join the discussionNo comments yet. Be the first to comment.