Master the git commands

Ronak Odhaviya
1 min readJul 7, 2018

--

Most of the following commands are self-explanatory, where it’s not, I’ve added minimal comments on the side for clarity.

git config — global user.name “username”
git config — global user.email “email”
git config — global color.ui true
git config — list

git init
git status

git add my_new_file #staging area
git add .
git add — all

git rm — cached my_old_file
git reset my_old_file
git rm -f

git commit -m “message”

git remote add origin https://github.com/username/my_git_folder.git

git push origin master
git push -u origin master
git push

git remote -v #list all the remote repos
git clone git@github.com:username/my_git_folder.git
git pull

git branch
git branch name_of_new_branch
git checkout name_of_branch
git checkout -b name_of_new_brach # two operations

git merge brach_name #you’re in the main branch and merging another into the main — not vice versa

git branch -d name_of_new_branch #delete

YOU HAVE MASTERED THE GIT COMMANDS

--

--