Git-cheat-sheet

Commonly used git commands

  1. Delete branch locally as well as in remote.
  • Checkout to a different branch -> git checkout
  • Delete branch locally -> git branch -d
  • Delete branch on remote -> git push --delete
  1. To check if a branch in local is sync with remote branch
  • Git fetch
  • Checkout to branch you want to check if it is in sync -> git checkout
  • See commits that are on remote but not on local -> git log HEAD..origin/
  • Check status of local branch compared to remote -> git status
  1. Apply remote changes to local branch
  • Checkout to the branch you want to apply changes -> git checkout
  • git merge origin/
  • Verify that local branch is up to date with remote- git log OR git status
  1. Bring branch that is present in remote to local.
  • git fetch
  • git checkout -b origin/