Creating a Branch Locally
This will create a new local branch called ‘localbranchname’ which will be a copy of the currently checkedout branch.
This is the equivalent to
where the first command creates the branch (a new pointer to the current commit) and the second command checkouts the newly created branch.
Pushing a new Branch to the Remote Repo
Once a branch has been created locally, and additional commits made perhaps, it is often necessary to push this to the remote repository for safe keeping or distribution. This is achieved with
Note: this cwas introduced in Git 1.7.0 so only works on this version or later. Previous versions require setting up tracking information.
Pulling a new Branch from a Remote Branch
If a branch was created on another workstation then pushed to the remote repository it can be pulled using