Created
August 12, 2021 13:04
-
-
Save antomor/82b59f325a62b5de05ee885835d61fe3 to your computer and use it in GitHub Desktop.
make a private fork of a public repo
This file contains 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
# from https://stackoverflow.com/a/30352360/6816965 | |
# 1. clone the publish repo and push it into the private one | |
git clone --bare https://github.com/exampleuser/public-repo.git | |
cd public-repo.git | |
git push --mirror https://github.com/yourname/private-repo.git | |
cd .. | |
rm -rf public-repo.git | |
# 2. work on the private repository as usual | |
git clone https://github.com/yourname/private-repo.git | |
cd private-repo | |
make some changes | |
git commit | |
git push origin master | |
# 3. sync the original repo with the private one | |
git remote add public https://github.com/exampleuser/public-repo.git | |
git pull public master # Creates a merge commit | |
git push origin master | |
# 4. PR private -> public | |
git clone https://github.com/yourname/the-fork.git | |
cd the-fork | |
git remote add private_repo_yourname https://github.com/yourname/private-repo.git | |
git checkout -b pull_request_yourname | |
git pull private_repo_yourname master | |
git push origin pull_request_yourname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment