Git – Create New Branch From Existing Branch

Please wait...

To create a new branch from existing one you first have to checkout new branch locally, then push it to remote so other can see it. Below are the exact commands.

Create new branch from existing branch locally

git checkout -b {NEW_branch_name} {SOURCE_branch_name}

Specifying -b causes a new branch to be created

Push changes to origin

git push origin {NEW_branch_name}

1 Comment
  1. Jcarnelian says

    This doesnt work it gives me
    ! [rejected] -> (non-fast-forward)

Leave A Reply

Your email address will not be published.