Skip to content

Instantly share code, notes, and snippets.

@eliza-abraham
Last active December 27, 2015 23:59
Show Gist options
  • Save eliza-abraham/7410620 to your computer and use it in GitHub Desktop.
Save eliza-abraham/7410620 to your computer and use it in GitHub Desktop.
Create new local branch for existing remote branch
Clone the target repository to your local computer.
$ git clone git@github.com:<username>/<project name>.git
Create a new oprhan branch
$ git checkout --orphan NEWBRANCH
Delete everything in it.
$ git rm -rf .
Merge/Pull the remote branch orphan branch into the local orphan branch
$ git merge BRANCHNAME
$ git pull origin BRANCHNAME
After committing push it to the target repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment