Creating a new local branch from master branch (i.e., new branch name: code-v0.1):
$ git branch code-v0.1
Switch to the new branch and send it to remote repository:
$ git checkout -b code-v0.1 $ git push origin -u code-v0.1
Copying an existing branch to a new branch (i.e., new branch name is source_code-v0.1 that is gonna be created when copying) and send the copied branch to the remote repository:
$ git branch source_code-v0.1 code-v0.1 $ git checkout -b source_code-v0.1 $ git push origin -u source_code-v0.1
Deleting an existing branch from local and remote repository (WARNING: Keep in mind that if you delete an existing branch at remote repository, you’re not gonna be able to bring it back. So, make sure that you really wanna delete the branch.):
$ git branch -d code-v0.1 $ git push --delete code-v0.1 NOTE: delete from remote
Renaming an existing repository and remove the old name (i.e., new name is my_code-r1). To remove, follow the steps immediately above.
$ git branch -m source_code-v0.1 mycode-stable
So, that’s it,
Hope it was helpful, ’till next post.