Created
April 28, 2020 06:30
-
-
Save cowboy-bebug/d976ccfbbb45a4763d9600fc6aac0f13 to your computer and use it in GitHub Desktop.
Fork a subdirectory of an upstream repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clone an upstream repo | |
git clone https://github.com/<user>/<project>.git && cd project | |
git branch -m upstream-master | |
git subtree split --prefix=<folder>/<subfolder> -b upstream-rebase | |
git checkout upstream-rebase | |
git remote rename origin upstream | |
git remote add origin https://github.com/<my-account>/<my-project>.git | |
git fetch origin | |
git push -u origin upstream-rebase | |
git checkout -b master | |
git push -u origin master | |
# To merge upstream changes | |
git checkout upstream-master | |
git pull | |
git subtree split --prefix=<folder>/<subfolder> --onto upstream-rebase -b upstream-rebase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment