Git advance

  1. git checkout -b branch-name origin/branch-name: To create and connect with a branch on remote. (it checkout from main to desired branch name and connect it)
  2. git branch --set-upstream-to=origin/branch-name: If you are already in desired branch you just need to connect with that remote branch.
  3. git push origin --delete branch-name: For delete remote branch.
  4. git branch -d branch-name: to delete a branch that is merged and now not need in local.
  5. git branch -D branch-name: to delete a branch neither merge in remote nor deleted.