How to switch from master to main git branch
git checkout master # to be sure you are on master branch
git push origin HEAD:main # and then push the current branch (as master) to main
-or-
git push --force origin HEAD:main
How to switch from master to main git branch
git checkout master # to be sure you are on master branch
git push origin HEAD:main # and then push the current branch (as master) to main
-or-
git push --force origin HEAD:main
git switch branch
git switch branch_name
git checkout branch_name
how to make new branch and switch in git
git checkout -b myNewBranch
git change master branch
## 1) Rename master branch to oldmaster.
git branch -m master oldmaster
#Now there is no master branch on my local machine.
## 2) Rename my masterTemp branch to master
git branch -m masterTemp master
#The branch which was named masterTemp on my local machine is now master
## 3) Delete the branch from remote
git branch -rD master
## 4) Push the new master branch to remote
git push --force origin master
how to switch branches in git
- git checkout xyz =
checks out the branch, switches to the branch.
- git checkout -b <branch_name> =
creates a new branch and switches to it.
- git merge <branch_name> =
this command takes changes from the given branch,
and merges with the current branches we are on.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us