Last active
October 27, 2025 17:07
-
-
Save devinschumacher/c0d45bc626999f19df5429c5cd549a8c to your computer and use it in GitHub Desktop.
Revisions
-
devinschumacher revised this gist
May 15, 2025 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,9 @@ tags: ## Click here to watch the video 👇 <a href="https://www.youtube.com/watch?v=uSKVQxOEark" target="_blank"><img src="https://gist.github.com/user-attachments/assets/68b409e3-8376-4c13-9fa9-8e677e7bdc1f" width="600px"></a> --- -
devinschumacher revised this gist
May 15, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ tags: 4. [Re-assign remotes](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#4-re-assign-remotes) 5. [Push branches to your private repo](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#5-push-branches-to-your-private-repo) 6. [(optional) check the it worked](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#6-optional-check-the-it-worked) 7. [Get to work](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#7-get-to-work) -
devinschumacher revised this gist
May 15, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,8 @@ tags: ## Click here to watch the video 👇 <a href="https://www.youtube.com/watch?v=uSKVQxOEark" target="_blank"><img src="https://i.ibb.co/6q8PFp5/7dad0a8df535.jpg" width="600px"></a> --- -
devinschumacher renamed this gist
May 2, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
devinschumacher revised this gist
Apr 29, 2025 . 1 changed file with 11 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -107,33 +107,26 @@ git remote set-url --push upstream no_push Then run `git remove -v` again, and you should the push remove ⚠️ However: GitHub pull requests are not tied to git push remotes. When you push to your origin (your fork), GitHub sees: - Your fork has new commits - Your fork was originally based on the place you forked from - GitHub suggests a PR back to upstream (since it knows the relationship) ✅ To be even safer, remove Github from offering PRs back to upstream: 👉 Detach the fork on GitHub: 1. Go to your fork: https://github.com/your-org/your-repo 2. Click Settings 3. Scroll to “Danger Zone” 4. Click “Detach fork” → Confirm This will: - Break GitHub’s fork link - Make GitHub stop suggesting PRs back to the original place you forked from - Keep your repo and remotes intact — you can still git fetch upstream from CLI -
devinschumacher revised this gist
Apr 29, 2025 . 1 changed file with 32 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -95,18 +95,47 @@ git remote show upstream git switch main ``` ## (optional) BUT VERY SAFE ### 1. Remove `push` ability to the upstream You can REMOVE the ability to push your now private (and probably NSWF filled) repo by running ```bash git remote set-url --push upstream no_push ``` Then run `git remove -v` again, and you should the push remove However: ⚠️ GitHub pull requests are not tied to git push remotes. When you push to your origin (your fork), GitHub sees: • Your fork has new commits • Your fork was originally based on the place you forked from • GitHub suggests a PR back to upstream (since it knows the relationship) This happens even if you: • Only pushed to origin • Have disabled push to upstream ⸻ ✅ To be even safer, remove Github from offering PRs back to upstream: 👉 Detach the fork on GitHub: 1. Go to your fork: https://github.com/your-org/your-repo 2. Click Settings 3. Scroll to “Danger Zone” 4. Click “Detach fork” → Confirm This will: • Break GitHub’s fork link • Make GitHub stop suggesting PRs back to serpcompany/serp-monorepo • But keep your repo and remotes intact — you can still git fetch upstream from CLI --- -
devinschumacher revised this gist
Apr 29, 2025 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -95,6 +95,19 @@ git remote show upstream git switch main ``` ## (optional) BUT VERY SAFE You can REMOVE the ability to push your now private (and probably NSWF filled) repo by running ```bash git remote set-url --push upstream no_push ``` Then run `git remove -v` again, and you should see safety git remote set-url --push upstream no_push --- # Example -
devinschumacher revised this gist
Apr 28, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,12 +11,12 @@ tags: # How to Create a Private “Fork” of a Public GitHub Repo | Step-by-step Guide 1. [Clone the original repository locally](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#1-clone-the-original-repository-locally) 2. [Create an empty private repo in your org](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#2-create-an-empty-private-repo-in-your-org) 3. [Create a local “fork” branch](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#3-create-a-local-fork-branch) 4. [Re-assign remotes](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#4-re-assign-remotes) 5. [Push branches to your private repo](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#5-push-branches-to-your-private-repo) 6. [(optional) check the it worked](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#6-optional-check-the-it-worked) 7.[ Get to work](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#7-get-to-work) -
devinschumacher revised this gist
Apr 28, 2025 . 1 changed file with 17 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,17 @@ tags: - cli --- # How to Create a Private “Fork” of a Public GitHub Repo | Step-by-step Guide 1. [Clone the original repository locally](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#1-clone-the-original-repository-locally) 2. Create an empty private repo in your org 3. [Create a local “fork” branch](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#3-create-a-local-fork-branch) 4. [Re-assign remotes](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#4-re-assign-remotes) 5. [Push branches to your private repo](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#5-push-branches-to-your-private-repo) 6. [(optional) check the it worked](https://gist.github.com/devinschumacher/c0d45bc626999f19df5429c5cd549a8c/edit#6-optional-check-the-it-worked) 7. Get to work ## Click here to watch the video 👇 @@ -73,15 +83,16 @@ git push -u origin main git push -u origin fork ``` ## 6. (optional) check the it worked: ```bash git remote show origin git remote show upstream ``` ## 7. Get to work ```bash git switch main ``` --- -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,12 @@ tags: # How to Create a Private “Fork” of a Public GitHub Repo ## Click here to watch the video 👇 <a href="https://www.youtube.com/watch?v=uSKVQxOEark" target="_blank"><img src="https://img.youtube.com/vi/uSKVQxOEark/maxresdefault.jpg" width="600px"></a> --- ## 1. Clone the original repository locally ```bash -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,12 +25,7 @@ mv <REPO_NAME> <NEW_NAME> cd <REPO_NAME> <NEW_NAME> ``` ## 2. Create an empty private repo in your org ```bash gh api \ --method POST \ @@ -40,6 +35,12 @@ gh api \ -f auto_init=false ``` ## 3. Create a local “fork” branch ```bash git checkout -b fork ``` ## 4. Re-assign remotes Rename the existing `origin` (public repo) to `upstream` and add your private repo as `origin`: -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -32,10 +32,12 @@ git checkout -b fork ## 3. Create an empty private repo in your org ```bash gh api \ --method POST \ /orgs/<YOUR_ORG>/repos \ -f name='<NEW_REPO_NAME>' \ -f private=true \ -f auto_init=false ``` ## 4. Re-assign remotes -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,12 @@ git checkout -b fork ``` ## 3. Create an empty private repo in your org ```bash gh repo create :<YOUR_ORG>/<NEW_REPO_NAME> \ --private \ --no-readme \ --confirm ``` ## 4. Re-assign remotes Rename the existing `origin` (public repo) to `upstream` and add your private repo as `origin`: -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -64,13 +64,19 @@ git push -u origin fork git switch main ``` ## (optional) check the it worked: ```bash git remote show origin git remote show upstream ``` --- # Example <img src="https://gist.github.com/user-attachments/assets/8e49d620-384f-40f9-8b16-4329e439f830" width="600px"> <img src="https://gist.github.com/user-attachments/assets/82535aee-2244-4fc4-b484-c29a4a6ad680" width="600px"> -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -68,7 +68,9 @@ git switch main --- # Example <img src="https://gist.github.com/user-attachments/assets/8e49d620-384f-40f9-8b16-4329e439f830" width="600px"> -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -68,6 +68,11 @@ git switch main ---  ## How to work privately and use the fork Confirmed. You can treat `fork` purely as your “upstream sync” branch and do all your actual work on `main`. Here’s the streamlined flow: -
devinschumacher revised this gist
Apr 27, 2025 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,11 +16,14 @@ tags: git clone https://github.com/<ORIGINAL_OWNER>/<REPO_NAME>.git ``` ```bash # Rename repo to whatever you want: mv <REPO_NAME> <NEW_NAME> # go into folder cd <REPO_NAME> <NEW_NAME> ``` ## 2. Create a local “fork” branch ```bash -
devinschumacher revised this gist
Apr 23, 2025 . 1 changed file with 10 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,10 +23,8 @@ mv <REPO_NAME> <NEW_NAME> ## 2. Create a local “fork” branch ```bash git checkout -b fork ``` ## 3. Create an empty private repo in your org @@ -38,6 +36,7 @@ Rename the existing `origin` (public repo) to `upstream` and add your private re ```bash git remote rename origin upstream git remote add origin [email protected]:<YOUR_ORG>/<NEW_REPO_NAME>.git git branch --set-upstream-to=upstream/main fork ``` Verify: @@ -57,8 +56,16 @@ git push -u origin main git push -u origin fork ``` ## 6. Get to work ```bash git switch main ``` 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 --- ## How to work privately and use the fork Confirmed. You can treat `fork` purely as your “upstream sync” branch and do all your actual work on `main`. Here’s the streamlined flow: @@ -93,8 +100,6 @@ Confirmed. You can treat `fork` purely as your “upstream sync” branch and do - **You never commit on** `fork`—it’s exclusively for pulling in the third-party repo’s updates. - All your feature work, bug-fixes, PRs, etc. happen on `main` (or feature branches off of `main`). ### Shortcut: Merging upstream directly into `main` If you’d rather skip the extra branch, just do: -
devinschumacher revised this gist
Apr 23, 2025 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,7 @@ mv <REPO_NAME> <NEW_NAME> ```bash git checkout -b fork git branch --set-upstream-to=upstream/main fork ``` ## 3. Create an empty private repo in your org -
devinschumacher created this gist
Apr 23, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,108 @@ --- title: "How to Create a Private “Fork” of a Public GitHub Repo" description: "Step-by-step guide to clone a public repo into a private repository in your organization while still pulling in upstream changes." tags: - git - github - private-fork - cli --- # How to Create a Private “Fork” of a Public GitHub Repo ## 1. Clone the original repository locally ```bash git clone https://github.com/<ORIGINAL_OWNER>/<REPO_NAME>.git ``` Rename repo to whatever you want: ```bash mv <REPO_NAME> <NEW_NAME> ``` ## 2. Create a local “fork” branch ```bash git checkout -b fork ``` ## 3. Create an empty private repo in your org - Github.com → New → Repository (Do not initialize with a README, license, or .gitignore. + leave Initialize this repository unchecked) ## 4. Re-assign remotes Rename the existing `origin` (public repo) to `upstream` and add your private repo as `origin`: ```bash git remote rename origin upstream git remote add origin [email protected]:<YOUR_ORG>/<NEW_REPO_NAME>.git ``` Verify: ```bash git remote -v # origin [email protected]:YOUR_ORG/NEW_REPO_NAME.git (fetch) # origin [email protected]:YOUR_ORG/NEW_REPO_NAME.git (push) # upstream https://github.com/<OWNER>/<REPO>.git (fetch) # upstream https://github.com/<OWNER>/<REPO>.git (push) ``` ## 5. Push branches to your private repo ```bash git push -u origin main git push -u origin fork ``` # How to work privately and use the fork Confirmed. You can treat `fork` purely as your “upstream sync” branch and do all your actual work on `main`. Here’s the streamlined flow: 1. **Clone your private fork** ```bash git clone [email protected]:YOUR_ORG/NEW_REPO_NAME.git cd NEW_REPO_NAME ``` 2. **Ensure your remotes are set** ```bash git remote add upstream https://github.com/ORIGINAL_OWNER/REPO.git # (only if you haven’t already) ``` 3. **Update the `fork` branch from upstream** ```bash git checkout fork # make sure fork tracks upstream/main: git branch --set-upstream-to=upstream/main fork git pull # fast-forwards fork ← upstream/main ``` 4. **Merge upstream changes into your `main`** ```bash git checkout main git merge fork # brings in all upstream updates git push origin main # pushes your updated main to your org ``` - **You never commit on** `fork`—it’s exclusively for pulling in the third-party repo’s updates. - All your feature work, bug-fixes, PRs, etc. happen on `main` (or feature branches off of `main`). --- ### Shortcut: Merging upstream directly into `main` If you’d rather skip the extra branch, just do: ```bash git fetch upstream git checkout main git merge upstream/main git push origin main ``` Either pattern keeps your `main` clean and your “sync” branch dedicated solely to upstream updates.