Skip to content

Instantly share code, notes, and snippets.

@benbalter
Created December 11, 2012 19:39
Show Gist options
  • Save benbalter/4261396 to your computer and use it in GitHub Desktop.
Save benbalter/4261396 to your computer and use it in GitHub Desktop.
How to fork a single branch of a repo, preserving commit log
mkdir target-repo
cd target-repo
git init
git remote add origin git@github.com...
git remote add upstream git@github.com....
git fetch upstream
git pull upstream master
git push origin master
Alternative:
git clone git@github.com...
cd target-repo
git remote add upstream git@github.com....
git fetch upstream
git pull upstream master
git push origin master
Copy link

ghost commented Sep 16, 2015

Where is the reference to any branch? I can only see references here to 'master'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment