You Must use these Git cmds

  • git init : Initialize a local Git repository
  • git clone repo_url : Clone public repository
  • git clone ssh://[username]/[repository-name].git : Clone private repository
  • git status: Check status
  • git add [file-name] : Add a file to the staging area
  • git add -A : Add all new and changed files to the staging area
  • git commit -m “[commit message]” : Commit changes
  • git rm -r [file-name.txt] : Remove a file (or folder)
  • git branch : List of branches (the asterisk denotes the current branch)
  • git branch -a : List all branches (local and remote)
  • git branch [branch name] : Create a new branch
  • git checkout -b [branch name]: Create a new branch and switch to it
  • git merge [branch name]: Merge a branch into the active branch
  • git merge [source branch] [target branch]: Merge a branch into a target branch
  • git push: Push changes to remote repository (remembered branch)
  • git push origin — delete [branch name] : Delete a remote branch
  • git pull : Update local repository to the newest commit
  • git pull origin [branch name]: Pull changes from remote repository
  • git remote add origin ssh://[username]/[repository-name].git: Add a remote repository
  • git log: View changes
  • git config — global “your_username”: Set globally Username



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sanjay Singh Rajpoot

Sanjay Singh Rajpoot

Summer of Bitcoin ’22 • LFX Mentee’22 @mojaglobal • GSoC’21 @ProcessingOrg • Ex-Intern @Disecto • 👨‍💻▪️ Full Stack Developer (MERN) • Tech Blogger