Git simple branching, published to remote

Simple git branching technique in my environment (master copies of repos hosted on my remote server):

Create new branch locally:

$ git branch <branch name>

Push the branch to the remote repository:

$ git push origin <branch name>

Now for the wrinkle: as mentioned here, the local branch is not yet tracking the remote branch. To fix this, overwrite the local branch with a tracking version:

$ $ git branch -f <branch name> origin/<branch name>

To merge the branch back into the ‘trunk’:

$ git checkout master
$ git merge <branch name>

To delete the local and remote versions of the branch:

$ git branch -d <branch name>
$ git push origin :<branch name>

You must be logged in to post a comment.