Skip to content

Commit f2d0d42

Browse files
committed
Standardize git remote naming on upstream/origin across docs and tooling
Airflow's contributing docs, release runbooks, and agent instructions used a mix of `apache`, `origin`, and placeholder names for the git remote that tracks `apache/airflow`. Standardize on `upstream` → `apache/airflow` and `origin` → the contributor's fork throughout — the two names already assumed by `dev/sync_fork.sh` and by most beginner-facing docs — so that contributors, release managers, and agents follow a single convention. - Add a new "Git remote naming conventions" section to `contributing-docs/10_working_with_git.rst` with migration commands for the common legacy layouts (`apache` remote, origin-as-upstream, missing upstream/fork). - Update `contributing-docs/10_working_with_git.rst`, `contributing-docs/18_contribution_workflow.rst`, and all `dev/README_RELEASE_*.md` runbooks to use `upstream` in examples and link to the conventions section. - Update `AGENTS.md` (= `CLAUDE.md`) to document the convention and instruct agents to surface remote-name mismatches to the user and propose concrete `git remote rename` commands instead of silently using whatever names they find. - Switch breeze CLI defaults and error messages to match: `--remote-name` now defaults to `upstream` in `release-management start-rc-process`, `release-management update-constraints`, and `sbom update-sbom-information`; `breeze ci find-backport-prs` warns about a missing `upstream` (not `apache`) remote; the fallback list in `tag_providers` now tries `upstream` first and keeps `apache`/`origin` for back-compat. - Regenerate the affected breeze help images and update the `basic-tests.yml` CI workflow to add `upstream` rather than `apache`.
1 parent 01c4c1d commit f2d0d42

22 files changed

Lines changed: 357 additions & 176 deletions

.github/workflows/basic-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ jobs:
352352
--answer yes --dry-run
353353
- name: "Test providers metadata generation"
354354
run: |
355-
git remote add apache https://github.com/apache/airflow.git
356-
git fetch apache --tags
355+
git remote add upstream https://github.com/apache/airflow.git
356+
git fetch upstream --tags
357357
breeze release-management generate-providers-metadata --refresh-constraints-and-airflow-releases
358358
env:
359359
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,75 @@ Add a newsfragment for user-visible changes:
150150

151151
- NEVER add Co-Authored-By with yourself as co-author of the commit. Agents cannot be authors, humans can be, Agents are assistants.
152152

153+
### Git remote naming conventions
154+
155+
Airflow standardises on two git remote names, and the rest of this file, the
156+
contributing docs, and the release docs all assume them:
157+
158+
- **`upstream`** — the canonical `apache/airflow` repository (fetch from here).
159+
- **`origin`** — the contributor's fork of `apache/airflow` (push PR branches here).
160+
161+
Always push branches to `origin`. Never push directly to `upstream` (and never
162+
push directly to `main` on either remote).
163+
164+
**Before running any remote-based command, run `git remote -v` and verify the
165+
names match this convention.** If they do not — for example, the upstream remote
166+
is called `apache`, or `origin` points at `apache/airflow` with the fork under a
167+
different name like `fork`**do not silently go along with the existing
168+
names**. Surface the mismatch to the user and propose the exact rename commands
169+
to bring the checkout in line with the convention, then ask the user to confirm
170+
before running them. Examples:
171+
172+
- Upstream is named `apache`, fork is `origin` (common legacy layout):
173+
174+
```bash
175+
git remote rename apache upstream
176+
```
177+
178+
- `origin` points at `apache/airflow` and the fork is named `fork` (release-manager
179+
/ "cloned upstream directly" layout):
180+
181+
```bash
182+
git remote rename origin upstream
183+
git remote rename fork origin
184+
```
185+
186+
- Upstream is missing entirely:
187+
188+
```bash
189+
git remote add upstream https://github.com/apache/airflow.git
190+
# or, for SSH:
191+
git remote add upstream git@github.com:apache/airflow.git
192+
```
193+
194+
- Fork is missing entirely:
195+
196+
```bash
197+
gh repo fork apache/airflow --remote --remote-name origin
198+
```
199+
200+
After any rename/add, re-run `git remote -v` to confirm the new state before
201+
continuing with commands that assume `upstream` / `origin`.
202+
203+
If a doc, script, or command you're about to run uses the old `apache` name (or
204+
any other variant), **translate it to the `upstream` convention** in what you
205+
propose to the user, rather than perpetuating the old name. Flag the stale
206+
documentation so it can be fixed in a follow-up.
207+
153208
### Creating Pull Requests
154209

155-
**Always push to the user's fork**, not to the upstream `apache/airflow` repo. Never push
156-
directly to `main`.
210+
**Always push to the user's fork (`origin`)**, not to `upstream` (`apache/airflow`).
211+
Never push directly to `main`.
212+
213+
Before pushing, confirm the remote setup matches the conventions above
214+
(`upstream``apache/airflow`, `origin` → your fork). Run `git remote -v` and,
215+
if the names don't match, propose renames as described in "Git remote naming
216+
conventions" — ask the user to confirm before running them.
157217

158-
Before pushing, determine the fork remote. Check `git remote -v` — if `origin` does **not**
159-
point to `apache/airflow`, use `origin` (it's the user's fork). If `origin` points to
160-
`apache/airflow`, look for another remote that points to the user's fork. If no fork remote
161-
exists, create one:
218+
If the fork remote does not exist at all, create one:
162219

163220
```bash
164-
gh repo fork apache/airflow --remote --remote-name fork
221+
gh repo fork apache/airflow --remote --remote-name origin
165222
```
166223

167224
Before pushing, perform a self-review of your changes following the Gen-AI review guidelines
@@ -186,18 +243,18 @@ Before pushing, always rebase your branch onto the latest target branch (usually
186243
to avoid merge conflicts and ensure CI runs against up-to-date code:
187244

188245
```bash
189-
git fetch <upstream-remote> <target_branch>
190-
git rebase <upstream-remote>/<target_branch>
246+
git fetch upstream <target_branch>
247+
git rebase upstream/<target_branch>
191248
```
192249

193250
If there are conflicts, resolve them and continue the rebase. If the rebase is too complex,
194251
ask the user for guidance.
195252

196-
Then push the branch to the fork remote and open the PR creation page in the browser
253+
Then push the branch to your fork (`origin`) and open the PR creation page in the browser
197254
with the body pre-filled (including the generative AI disclosure already checked):
198255

199256
```bash
200-
git push -u <fork-remote> <branch-name>
257+
git push -u origin <branch-name>
201258
gh pr create --web --title "Short title (under 70 chars)" --body "$(cat <<'EOF'
202259
Brief description of the changes.
203260

contributing-docs/10_working_with_git.rst

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,42 @@ that we are using rebase workflow. It also explains how to sync your fork with t
2626
:depth: 2
2727
:local:
2828

29+
Git remote naming conventions
30+
=============================
31+
32+
Airflow documentation, helper scripts (``dev/sync_fork.sh``), release tooling and
33+
agent instructions (``AGENTS.md``) all assume the following two remote names, and
34+
you should configure your local checkout to match:
35+
36+
* ``upstream`` — the canonical ``apache/airflow`` repository (where you fetch from).
37+
* ``origin`` — your personal fork of ``apache/airflow`` (where you push branches
38+
for PRs).
39+
40+
Never push directly to ``upstream`` and never push directly to ``main`` on either
41+
remote. PR branches always go to ``origin``.
42+
43+
If your existing checkout uses different names (for example ``apache`` for the
44+
Apache remote, or ``origin`` pointing at ``apache/airflow`` with your fork under
45+
another name), rename them to match the convention. Common migrations:
46+
47+
.. code-block:: bash
48+
49+
# Case 1: upstream is currently named "apache"
50+
git remote rename apache upstream
51+
52+
# Case 2: "origin" points at apache/airflow and your fork is named "fork"
53+
git remote rename origin upstream
54+
git remote rename fork origin
55+
56+
# Case 3: upstream is missing entirely
57+
git remote add upstream https://github.com/apache/airflow.git
58+
# ... or via SSH:
59+
git remote add upstream git@github.com:apache/airflow.git
60+
61+
Then confirm with ``git remote -v``. Ad-hoc remote names still work for one-off
62+
commands, but the helper scripts and documented workflows below all assume
63+
``upstream`` / ``origin``.
64+
2965
Airflow Git Branches
3066
====================
3167

@@ -68,7 +104,7 @@ How to sync your fork
68104

69105
When you have your fork, you should periodically synchronize the main of your fork with the
70106
Apache Airflow main. In order to do that you can ``git pull --rebase`` to your local git repository from
71-
apache remote and push the main (often with ``--force`` to your fork). There is also an easy
107+
the ``upstream`` remote and push the main (often with ``--force`` to your fork). There is also an easy
72108
way to sync your fork in GitHub's web UI with the `Fetch upstream feature
73109
<https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-from-the-web-ui>`_.
74110

@@ -139,30 +175,30 @@ First of all, we suggest you read about the rebase workflow here:
139175
`Merging vs. rebasing <https://www.atlassian.com/git/tutorials/merging-vs-rebasing>`_. This is an
140176
excellent article that describes all the ins/outs of the rebase workflow. I recommend keeping it for future reference.
141177

142-
The goal of rebasing your PR on top of ``apache/main`` is to "transplant" your change on top of
178+
The goal of rebasing your PR on top of ``upstream/main`` is to "transplant" your change on top of
143179
the latest changes that are merged by others. It also allows you to fix all the conflicts
144-
that arise as a result of other people changing the same files as you and merging the changes to ``apache/main``.
180+
that arise as a result of other people changing the same files as you and merging the changes to ``upstream/main``.
145181

146182
Here is how rebase looks in practice (you can find a summary below these detailed steps):
147183

148184
1. You first need to add the Apache project remote to your git repository. This is only necessary once,
149-
so if it's not the first time you are following this tutorial you can skip this step. In this example,
150-
we will be adding the remote as "apache" so you can refer to it easily
185+
so if it's not the first time you are following this tutorial you can skip this step. Per the
186+
`Git remote naming conventions`_ we add it as ``upstream``:
151187

152-
* If you use ssh: ``git remote add apache git@github.com:apache/airflow.git``
153-
* If you use https: ``git remote add apache https://github.com/apache/airflow.git``
188+
* If you use ssh: ``git remote add upstream git@github.com:apache/airflow.git``
189+
* If you use https: ``git remote add upstream https://github.com/apache/airflow.git``
154190

155-
2. You then need to make sure that you have the latest main fetched from the ``apache`` repository. You can do this
191+
2. You then need to make sure that you have the latest main fetched from the ``upstream`` repository. You can do this
156192
via
157193

158-
``git fetch apache`` (to fetch apache remote)
194+
``git fetch upstream`` (to fetch upstream remote)
159195

160196
``git fetch --all`` (to fetch all remotes)
161197

162198
3. Assuming that your feature is in a branch in your repository called ``my-branch`` you can easily check
163199
what is the base commit you should rebase from via
164200

165-
``git merge-base my-branch apache/main``
201+
``git merge-base my-branch upstream/main``
166202

167203
This will print the HASH of the base commit which you should use to rebase your feature from.
168204
For example: ``5abce471e0690c6b8d06ca25685b0845c5fd270f``. Copy that HASH and go to the next step.
@@ -201,11 +237,11 @@ we will be adding the remote as "apache" so you can refer to it easily
201237

202238
6. Rebase
203239

204-
``git rebase HASH --onto apache/main``
240+
``git rebase HASH --onto upstream/main``
205241

206242
For example:
207243

208-
``git rebase 5abce471e0690c6b8d06ca25685b0845c5fd270f --onto apache/main``
244+
``git rebase 5abce471e0690c6b8d06ca25685b0845c5fd270f --onto upstream/main``
209245

210246
Rebasing is a good practice recommended to follow for all code changes.
211247

@@ -249,9 +285,9 @@ Useful when you understand the flow but don't remember the steps and want a quic
249285
git fetch --all
250286
git add .
251287
git commit
252-
git merge-base my-branch apache/main
288+
git merge-base my-branch upstream/main
253289
git checkout my-branch
254-
git rebase HASH --onto apache/main
290+
git rebase HASH --onto upstream/main
255291
git push --force-with-lease
256292
257293
-------

contributing-docs/18_contribution_workflow.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,18 @@ Step 4: Prepare PR
165165
`How to sync your fork <10_working_with_git.rst#how-to-sync-your-fork>`_ for details.
166166

167167
* Create a local branch for your development. Make sure to use latest
168-
``apache/main`` as base for the branch. See `How to Rebase PR </contributing-docs/10_working_with_git.rst#how-to-rebase-pr>`_ for some details
169-
on setting up the ``apache`` remote. Note, some people develop their changes directly in their own
170-
``main`` branches - this is OK and you can make PR from your main to ``apache/main`` but we
168+
``upstream/main`` as base for the branch. See `How to Rebase PR </contributing-docs/10_working_with_git.rst#how-to-rebase-pr>`_ for details
169+
on setting up the ``upstream`` remote (Airflow standardises on ``upstream`` →
170+
``apache/airflow`` and ``origin`` → your fork — see
171+
`Git remote naming conventions </contributing-docs/10_working_with_git.rst#git-remote-naming-conventions>`_).
172+
Note, some people develop their changes directly in their own
173+
``main`` branches - this is OK and you can make PR from your main to ``upstream/main`` but we
171174
recommend to always create a local branch for your development. This allows you to easily compare
172175
changes, have several changes that you work on at the same time and many more.
173-
If you have ``apache`` set as remote then you can make sure that you have latest changes in your main
174-
by ``git pull apache main`` when you are in the local ``main`` branch. If you have conflicts and
176+
With ``upstream`` configured you can make sure that you have latest changes in your main
177+
by ``git pull upstream main`` when you are in the local ``main`` branch. If you have conflicts and
175178
want to override your locally changed main you can override your local changes with
176-
``git fetch apache; git reset --hard apache/main``.
179+
``git fetch upstream; git reset --hard upstream/main``.
177180

178181
* Modify the class and add necessary code and unit tests.
179182

dev/MANUALLY_GENERATING_IMAGE_CACHE_AND_CONSTRAINTS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,15 @@ This is a step-by-step instruction on how to use it:
279279
1. You need to have "airflow" repository checked out separately from the repository you are working on. For
280280
example in `/home/myuser/airflow-constraints` folder.
281281
2. You need to checkout `constraints-main` branch in this repository. By default the command expects that
282-
there is a remote named "apache" pointing to the official Apache repository. You can override this
283-
by passing `--remote-name` option to the command.
282+
there is a remote named "upstream" pointing to the `apache/airflow` repository (the standard remote
283+
naming convention — see
284+
[`contributing-docs/10_working_with_git.rst`](../contributing-docs/10_working_with_git.rst#git-remote-naming-conventions)).
285+
You can override this by passing `--remote-name` option to the command.
284286
3. You need to run `breeze release-management update-constraints` command. The `breeze` command comes usually
285287
from another clone of airflow repository - usually from the `main` branch. You should pass those options to
286288
the command:
287289
* path to the "constraints" repository
288-
* remote name where the constraints should be pushed (optionally - default "apache")
290+
* remote name where the constraints should be pushed (optionally - default "upstream")
289291
* list of airflow versions to update constraints for
290292
* list of constraints to update in the form of "package==version" (you can specify it multiple times)
291293
* message to be used in the commit message

dev/README_RELEASE_AIRFLOW.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,18 +297,32 @@ You are likely want to cherry-pick some of the latest doc changes in order to br
297297
explanations added to the documentation. Usually you can see the list of such changes via:
298298

299299
```shell
300-
git fetch apache
301-
git log --oneline apache/v3-2-test | sed -n 's/.*\((#[0-9]*)\)$/\1/p' > /tmp/merged
302-
git log --oneline --decorate apache/v2-2-stable..apache/main -- docs/apache-airflow docs/docker-stack/ | grep -vf /tmp/merged
300+
git fetch upstream
301+
git log --oneline upstream/v3-2-test | sed -n 's/.*\((#[0-9]*)\)$/\1/p' > /tmp/merged
302+
git log --oneline --decorate upstream/v2-2-stable..upstream/main -- docs/apache-airflow docs/docker-stack/ | grep -vf /tmp/merged
303303
```
304304

305305
Those changes that are "doc-only" changes should be marked with `type:doc-only` label so that they
306306
land in documentation part of the changelog. The tool to review and assign the labels is described below.
307307

308308
## Making the cherry picking
309309

310-
It is recommended to clone Airflow upstream (not your fork) and run the commands on
311-
the relevant test branch in this clone. That way origin points to the upstream repo.
310+
It is recommended to clone Airflow from `apache/airflow` directly (not your fork) into a
311+
dedicated release-manager checkout and run the commands on the relevant test branch there.
312+
This repo follows the standard convention that `upstream``apache/airflow` and `origin`
313+
→ your fork (see
314+
[`contributing-docs/10_working_with_git.rst`](../contributing-docs/10_working_with_git.rst#git-remote-naming-conventions)),
315+
so in this release-manager clone add `apache/airflow` as `upstream`:
316+
317+
```shell
318+
git remote add upstream https://github.com/apache/airflow.git
319+
git fetch upstream
320+
```
321+
322+
All the commands in this document assume `upstream` is the remote that tracks
323+
`apache/airflow`. If you previously set this up under a different name (e.g. `apache`),
324+
either rename it with `git remote rename apache upstream` or pass the alternative name
325+
via the `--remote-name` option where the commands accept it.
312326

313327
To see cherry picking candidates (unmerged PR with the appropriate milestone), from the test
314328
branch you can run:
@@ -344,7 +358,7 @@ We have the tool that allows to review cherry-picked PRs and assign the labels
344358
It allows to manually review and assign milestones and labels to cherry-picked PRs:
345359

346360
```shell
347-
./dev/assign_cherry_picked_prs_with_milestone.py assign-prs --previous-release v2-2-stable --current-release apache/v2-2-test --milestone-number 48
361+
./dev/assign_cherry_picked_prs_with_milestone.py assign-prs --previous-release v2-2-stable --current-release upstream/v2-2-test --milestone-number 48
348362
```
349363

350364
It summarises the state of each cherry-picked PR including information whether it is going to be
@@ -360,7 +374,7 @@ assumes the `--skip-assigned` flag, so that the summary can be produced without
360374

361375
```shell
362376
./dev/assign_cherry_picked_prs_with_milestone.py assign-prs --previous-release v2-2-stable \
363-
--current-release apache/v2-2-test --milestone-number 48 --skip-assigned --assume-yes --print-summary \
377+
--current-release upstream/v2-2-test --milestone-number 48 --skip-assigned --assume-yes --print-summary \
364378
--output-folder /tmp
365379
```
366380

@@ -386,13 +400,13 @@ git show --format=tformat:"" --stat --name-only $(cat /tmp/doc-only-changes.txt)
386400
Then if you see suspicious file (example airflow/sensors/base.py) you can find details on where they came from:
387401

388402
```shell
389-
git log apache/v3-2-test --format="%H" -- airflow/sensors/base.py | grep -f /tmp/doc-only-changes.txt | xargs git show
403+
git log upstream/v3-2-test --format="%H" -- airflow/sensors/base.py | grep -f /tmp/doc-only-changes.txt | xargs git show
390404
```
391405

392406
And the URL to the PR it comes from:
393407

394408
```shell
395-
git log apache/v3-2-test --format="%H" -- airflow/sensors/base.py | grep -f /tmp/doc-only-changes.txt | \
409+
git log upstream/v3-2-test --format="%H" -- airflow/sensors/base.py | grep -f /tmp/doc-only-changes.txt | \
396410
xargs -n 1 git log --oneline --max-count=1 | \
397411
sed s'/.*(#\([0-9]*\))$/https:\/\/github.com\/apache\/airflow\/pull\/\1/'
398412
```
@@ -484,7 +498,7 @@ uv tool install -e ./dev/breeze
484498

485499
```shell script
486500
git checkout v${VERSION_BRANCH}-test
487-
git reset --hard origin/v${VERSION_BRANCH}-test
501+
git reset --hard upstream/v${VERSION_BRANCH}-test
488502
```
489503

490504
- Create a new branch from v${VERSION_BRANCH}-test
@@ -635,13 +649,14 @@ uv tool install -e ./dev/breeze
635649
Before running the actual release command, you can safely test it using:
636650

637651
```shell script
638-
# Test with dry-run (shows what would be executed without doing it)
652+
# Test with dry-run (shows what would be executed without doing it).
653+
# --remote-name defaults to "upstream" per the project convention, so only
654+
# pass it explicitly if you set apache/airflow up under a different name.
639655
breeze release-management start-rc-process \
640656
--version ${VERSION_RC} \
641657
--previous-version ${PREVIOUS_VERSION} \
642658
--task-sdk-version ${TASK_SDK_VERSION_RC} \
643659
--sync-branch ${SYNC_BRANCH} \
644-
--remote-name upstream \
645660
--dry-run
646661
```
647662

@@ -899,7 +914,7 @@ VERSION_SUFFIX=rc1
899914
VERSION_RC=${VERSION}${VERSION_SUFFIX}
900915
TASK_SDK_VERSION=X.Y.Z
901916
TASK_SDK_VERSION_RC=${TASK_SDK_VERSION}${VERSION_SUFFIX}
902-
git fetch apache --tags
917+
git fetch upstream --tags
903918
git checkout ${VERSION_RC}
904919
export AIRFLOW_REPO_ROOT=$(pwd)
905920
rm -rf dist/*

0 commit comments

Comments
 (0)