
While working on a project using git repository, if you want to create and switch to a new branch, then use: git checkout -b [my-branch-name]
To simply checkout a branch, use: git checkout [my-branch-name]
If you want to rename a branch when pointed to any other branch, you can type the following command: git branch -m [old-branch-name] [new-branch-name]
To rename the current branch, use: git branch -m [new-branch-name]