Issues and pull requests / Stacks and private work
Work on a change in private
You keep a public repository, and you want to build something before anyone knows about it: a v1, an experiment, or the blog post for a release. A normal pull request shows the work to everyone.
6 min read
A private pull request is a normal pull request that only your team can see. Its branch lives in a private companion repository, so its commits stay out of the public repository until you merge.
You need:
- Write access to the public repository.
src, logged in.
1. Commit your work on a branch
In a clone of the public repository, run:
git switch -c v1
git add .
git commit -m "Start v1"
Caution
Do not push the branch to origin. Everyone can read a branch of the public repository.
2. Open the private pull request
src pr create --private --title "Version 1" --body "Not public yet"
src prints the URL of the pull request. Before that, it does three things:
- The first time, it makes the private companion repository,
<owner>/<name>.private. - It pushes your branch to the companion. It never pushes to
origin. - It sets git's
branch.v1.pushRemoteto the companion.
--fill and --draft work as for any pull request. The pull request page shows a Private badge under the title.
3. Push more commits
git commit -am "Add the new API"
git push
git push from this branch goes to the companion, because src set branch.v1.pushRemote. The pull request gets the new commits, and CI runs on them.
4. Let CI and the agents check it
CI runs on a private pull request as on any pull request:
- The workflows, secrets and branch rules of the public repository apply.
- Required checks block the merge until they pass.
- Its runs, logs, artifacts and checks show only to the people who can see the pull request.
- Its jobs keep a cache of their own, and comment and push only on their own pull request.
The factory agents run on it too. Their results show only to the same people.
5. Merge it
Merge it as any other pull request. The commits go into the public repository, so everyone can read the code. The pull request itself stays private.
On a repository that syncs with GitHub, GitHub has no private pull requests, so yours stays here until you merge it. A merge into a release branch goes to GitHub first: the forge pushes the merge to GitHub's branch with your GitHub token, and the branch comes down here after GitHub took it. You need GitHub connected for this. See Merge on a synced repository.
To show the conversation too, make the pull request public. This works before and after a merge.
To get feedback from one person outside the team first, share the pull request with them, read only.
Done
Your team works on the change in a pull request that nobody else can see. Each git push from the branch goes to the companion, and CI and the agents check each commit. When the change is ready, you merge it or make it public.
Who sees what
- People with write access to the public repository, and their agents: they see the pull request, and they can push to its branch.
- The author: sees the pull request.
- People you share it with: read it only, with a link or by name. See Share a private pull request.
- Everyone else: sees nothing. The pull request is not in lists, search, counts or CI pages.
The private companion
src pr create --private makes the companion the first time.
- Its name is
<name>.private, under the same owner. If that name is taken, the name gets a number at its end:<name>.private-2,<name>.private-3and more. - Every person with write access to the public repository can read it and push to it. Nobody else can.
- No list shows it. You reach its branches through the private pull requests.
- It has no issues or pull requests of its own. A link to a number under the companion, such as
<owner>/<name>.private/pull/12, opens pull request #12 of the public repository, where the private pull request is. - It has no settings of its own. Nobody can make it public, rename it or fork it.
- It goes away with the public repository.
- Its default branch follows the default branch of the public repository. Each new commit there, from a push, a merge or GitHub sync, reaches the companion on the forge's own servers, with no push. So when you rebase your branch on the newest commits,
git pushsends only your own commits. - It follows forward only. If someone pushed commits of their own to the companion's default branch, it stops following, so those commits stay. To reset it to the public branch, a person runs
src repo sync <owner>/<name>.private --force.
Later: find your private pull requests
The pull request list shows a Private badge on each private pull request. To see only those:
- Open the public repository, then Pull requests.
- Click Visibility, then Private.
The URL keeps the filter (?visibility=private), so you can share the link with your team. Click the x next to the menu to clear it. Public lists only the others.
Your agent gets the same list with src pr list --visibility private. Over REST, add visibility=private to GET /api/v1/repos/{owner}/{repo}/pulls. The MCP tool list_pull_requests takes visibility: "private".
Later: open one on the web
The web form opens a private pull request from a branch that is in the companion already.
- Open the public repository, then Pull requests.
- Click New pull request.
- Turn on Private. The branch list now shows the branches of the companion.
- Pick your branch, fill in the title, then click Create pull request.
You see the Private switch only with write access. If the companion has no branch yet, the page shows the src pr create --private command.
Later: let your agent do it
An agent opens a private pull request over MCP or REST. The REST paths are under /api/v1/repos/{owner}/{repo}.
| Step | MCP tool | REST |
|---|---|---|
1. Get the companion. The answer has its cloneUrl. | get_private_remote | POST /private-remote |
2. Push the branch to cloneUrl, never to the public repository. | (git) | (git) |
| 3. Open the pull request. | create_pull_request, with private: true | POST /pulls, with "private": true |
- Both calls need write access. The first call makes the companion when it has none.
- An agent session token on the public repository also works on its companion, with the same limits.
- The answer of step 3 has
visibility,privatefor a private pull request.
See Connect over MCP and Use the REST API.