-
Notifications
You must be signed in to change notification settings - Fork 16.9k
Standardize git remote naming on upstream/origin across docs and tooling #65629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
825d64e
417e4ef
17c107b
475f8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,44 @@ that we are using rebase workflow. It also explains how to sync your fork with t | |
| :depth: 2 | ||
| :local: | ||
|
|
||
| Git remote naming conventions | ||
| ============================= | ||
|
|
||
| Airflow documentation, helper scripts (``dev/sync_fork.sh``), release tooling and | ||
| agent instructions (``AGENTS.md``) all assume the following two remote names, and | ||
| you should configure your local checkout to match: | ||
|
|
||
| * ``upstream`` — the canonical ``apache/airflow`` repository (where you fetch from). | ||
| * ``origin`` — your personal fork of ``apache/airflow`` (where you push branches | ||
| for PRs). | ||
|
|
||
| Always push PR branches to ``origin``; don't push to ``upstream`` (the branch | ||
| protection on ``apache/airflow`` will reject it anyway). Working on dedicated | ||
| branches is recommended, though developing directly on your fork's ``main`` is | ||
| tolerated — see `Contribution Workflow </contributing-docs/18_contribution_workflow.rst#step-4-prepare-pr>`_. | ||
|
|
||
| If your existing checkout uses different names (for example ``apache`` for the | ||
| Apache remote, or ``origin`` pointing at ``apache/airflow`` with your fork under | ||
| another name), rename them to match the convention. Common migrations: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| # Case 1: upstream is currently named "apache" | ||
| git remote rename apache upstream | ||
|
|
||
| # Case 2: "origin" points at apache/airflow and your fork is named "fork" | ||
| git remote rename origin upstream | ||
| git remote rename fork origin | ||
|
|
||
| # Case 3: upstream is missing entirely | ||
| git remote add upstream https://github.com/apache/airflow.git | ||
| # ... or via SSH: | ||
| git remote add upstream git@github.com:apache/airflow.git | ||
|
|
||
| Then confirm with ``git remote -v``. Ad-hoc remote names still work for one-off | ||
| commands, but the helper scripts and documented workflows below all assume | ||
| ``upstream`` / ``origin``. | ||
|
|
||
| Airflow Git Branches | ||
| ==================== | ||
|
|
||
|
|
@@ -68,7 +106,7 @@ How to sync your fork | |
|
|
||
| When you have your fork, you should periodically synchronize the main of your fork with the | ||
| Apache Airflow main. In order to do that you can ``git pull --rebase`` to your local git repository from | ||
| apache remote and push the main (often with ``--force`` to your fork). There is also an easy | ||
| the ``upstream`` remote and push the main (often with ``--force`` to your fork). There is also an easy | ||
| way to sync your fork in GitHub's web UI with the `Fetch upstream feature | ||
| <https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-from-the-web-ui>`_. | ||
|
|
||
|
|
@@ -139,30 +177,30 @@ First of all, we suggest you read about the rebase workflow here: | |
| `Merging vs. rebasing <https://www.atlassian.com/git/tutorials/merging-vs-rebasing>`_. This is an | ||
| excellent article that describes all the ins/outs of the rebase workflow. I recommend keeping it for future reference. | ||
|
|
||
| The goal of rebasing your PR on top of ``apache/main`` is to "transplant" your change on top of | ||
| The goal of rebasing your PR on top of ``upstream/main`` is to "transplant" your change on top of | ||
| the latest changes that are merged by others. It also allows you to fix all the conflicts | ||
| that arise as a result of other people changing the same files as you and merging the changes to ``apache/main``. | ||
| that arise as a result of other people changing the same files as you and merging the changes to ``upstream/main``. | ||
|
|
||
| Here is how rebase looks in practice (you can find a summary below these detailed steps): | ||
|
|
||
| 1. You first need to add the Apache project remote to your git repository. This is only necessary once, | ||
| so if it's not the first time you are following this tutorial you can skip this step. In this example, | ||
| we will be adding the remote as "apache" so you can refer to it easily | ||
| so if it's not the first time you are following this tutorial you can skip this step. Per the | ||
| `Git remote naming conventions`_ we add it as ``upstream``: | ||
|
|
||
| * If you use ssh: ``git remote add apache git@github.com:apache/airflow.git`` | ||
| * If you use https: ``git remote add apache https://github.com/apache/airflow.git`` | ||
| * If you use ssh: ``git remote add upstream git@github.com:apache/airflow.git`` | ||
| * If you use https: ``git remote add upstream https://github.com/apache/airflow.git`` | ||
|
||
|
|
||
| 2. You then need to make sure that you have the latest main fetched from the ``apache`` repository. You can do this | ||
| 2. You then need to make sure that you have the latest main fetched from the ``upstream`` repository. You can do this | ||
| via | ||
|
|
||
| ``git fetch apache`` (to fetch apache remote) | ||
| ``git fetch upstream`` (to fetch upstream remote) | ||
|
|
||
| ``git fetch --all`` (to fetch all remotes) | ||
|
|
||
| 3. Assuming that your feature is in a branch in your repository called ``my-branch`` you can easily check | ||
| what is the base commit you should rebase from via | ||
|
|
||
| ``git merge-base my-branch apache/main`` | ||
| ``git merge-base my-branch upstream/main`` | ||
|
|
||
| This will print the HASH of the base commit which you should use to rebase your feature from. | ||
| For example: ``5abce471e0690c6b8d06ca25685b0845c5fd270f``. Copy that HASH and go to the next step. | ||
|
|
@@ -201,11 +239,11 @@ we will be adding the remote as "apache" so you can refer to it easily | |
|
|
||
| 6. Rebase | ||
|
|
||
| ``git rebase HASH --onto apache/main`` | ||
| ``git rebase HASH --onto upstream/main`` | ||
|
|
||
| For example: | ||
|
|
||
| ``git rebase 5abce471e0690c6b8d06ca25685b0845c5fd270f --onto apache/main`` | ||
| ``git rebase 5abce471e0690c6b8d06ca25685b0845c5fd270f --onto upstream/main`` | ||
|
|
||
| Rebasing is a good practice recommended to follow for all code changes. | ||
|
|
||
|
|
@@ -249,9 +287,9 @@ Useful when you understand the flow but don't remember the steps and want a quic | |
| git fetch --all | ||
| git add . | ||
| git commit | ||
| git merge-base my-branch apache/main | ||
| git merge-base my-branch upstream/main | ||
| git checkout my-branch | ||
| git rebase HASH --onto apache/main | ||
| git rebase HASH --onto upstream/main | ||
| git push --force-with-lease | ||
|
|
||
| ------- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,13 +279,15 @@ This is a step-by-step instruction on how to use it: | |
| 1. You need to have "airflow" repository checked out separately from the repository you are working on. For | ||
| example in `/home/myuser/airflow-constraints` folder. | ||
| 2. You need to checkout `constraints-main` branch in this repository. By default the command expects that | ||
| there is a remote named "apache" pointing to the official Apache repository. You can override this | ||
| by passing `--remote-name` option to the command. | ||
| there is a remote named "upstream" pointing to the `apache/airflow` repository (the standard remote | ||
| naming convention — see | ||
| [`contributing-docs/10_working_with_git.rst`](../contributing-docs/10_working_with_git.rst#git-remote-naming-conventions)). | ||
| You can override this by passing `--remote-name` option to the command. | ||
| 3. You need to run `breeze release-management update-constraints` command. The `breeze` command comes usually | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rewriting this bullet to avoid using "usually" twice. Suggestions by gemini:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Applied option 1 ("Typically, |
||
| from another clone of airflow repository - usually from the `main` branch. You should pass those options to | ||
| the command: | ||
| * path to the "constraints" repository | ||
| * remote name where the constraints should be pushed (optionally - default "apache") | ||
| * remote name where the constraints should be pushed (optionally - default "upstream") | ||
| * list of airflow versions to update constraints for | ||
| * list of constraints to update in the form of "package==version" (you can specify it multiple times) | ||
| * message to be used in the commit message | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.