Skip to content
This repository was archived by the owner on Nov 29, 2017. It is now read-only.

Git Remote Branching

Oren Kanner edited this page Sep 27, 2015 · 2 revisions

The following commands create both a remote and local branch with tracking between them and checks out the local branch. Make sure your base branch is up-to-date!

EDIT 2015/09/27: Some of these commands may be redundant due to changes in Git v2, but they can't hurt!

git push origin [BASE_BRANCH]:refs/heads/[NEW_BRANCH_NAME]
git fetch origin
git branch --track [NEW_BRANCH_NAME] origin/[NEW_BRANCH_NAME]
git checkout [NEW_BRANCH_NAME]

For example:

git push origin master:refs/heads/404_branch_not_found
git fetch origin
git branch --track 404_branch_not_found origin/404_branch_not_found
git checkout 404_branch_not_found
Clone this wiki locally