Skip to content

Instantly share code, notes, and snippets.

@eznix86
Forked from benbalter/fork-a-branch.sh
Created March 26, 2020 06:08
Show Gist options
  • Save eznix86/e1d67af304043fc5feee6c0db2fde8bc to your computer and use it in GitHub Desktop.
Save eznix86/e1d67af304043fc5feee6c0db2fde8bc 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 [email protected]...
git remote add upstream [email protected]....
git fetch upstream
git pull upstream master
git push origin master
Alternative:
git clone [email protected]...
cd target-repo
git remote add upstream [email protected]....
git fetch upstream
git pull upstream master
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment