Sparse checkout is a useful Git feature that lets you only download and work with specific parts of a repository. The PortMaster-New repository is massive — over 50GB in size. Since you're most likely not going to be modifying multiple ports, there's no need to download the entire thing. Use sparse checkout to only grab what you need.
Since you’ll be working in the terminal, you'll need Git installed. Download and install it, either using sudo apt install git
or downloading Git for Windows depending on your platform. If you use GitHub Desktop, you may already have Git installed. You can check if it’s installed by running git --version
in your terminal.
If you haven't done so, fork the repository at https://github.com/PortsMaster/PortMaster-New. You can do this in a web browser. In your computer's terminal, clone it:
git clone --filter=blob:none --depth 1 --no-checkout https://github.com/USERNAME/PortMaster-New PortMaster-New-Fork
And then run:
cd PortMaster-New-Fork
git config core.sparseCheckout true
This will put you in the cloned directory and setup sparse checkout. Let's suppose you have an existing port you want to update, like Sonic 3 AIR.
On Linux: echo ports/sonic3air/ >> .git/info/sparse-checkout
On Windows: echo ports/sonic3air/ | Out-File .git/info/sparse-checkout -Encoding UTF8
This tells git that you only want to grab ports/sonic3air
from the repository. Now, check out the files:
git checkout main
And create a new branch:
git checkout -b sonic3air-update
You can now make your changes: your repository directory now includes ports/sonic3air
and all its files. After making changes, commit them:
git add ports/sonic3air/
git commit -m "Updated Sonic 3 A.I.R. port configuration"
git push origin sonic3air-update
If you’ve stepped away for a few days and want to update your fork before submitting, you can rebase it against the latest upstream repository. To do so:
git remote add upstream https://github.com/PortsMaster/PortMaster-New
git fetch upstream
git rebase upstream/main
Resolve conflicts if needed.
Open the pull request either by using the website or by using the following command in terminal:
gh pr create --web
Follow the onscreen prompts. Once done, you'll see it on the upstream repository page: https://github.com/PortsMaster/PortMaster-New/pulls. This example was PortsMaster/PortMaster-New#1522.