vcs:gitworkflow
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
vcs:gitworkflow [2019/01/28 10:01] – Update for 7.4 branch and EOLs nikic | vcs:gitworkflow [2023/08/31 08:55] (current) – Add --atomic flag ilutov | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Git Workflow ====== | ====== Git Workflow ====== | ||
- | **Also read [[vcs:: | + | **Also read [[vcs:: |
Git does not enforce a certain workflow. For php-src we will use a workflow that is described below. | Git does not enforce a certain workflow. For php-src we will use a workflow that is described below. | ||
We will use release branches for the php-src.git repository. We will have branches for actively maintained | We will use release branches for the php-src.git repository. We will have branches for actively maintained | ||
- | versions. For example: **7.2**, **7.3**, **7.4** and **master** . A patch will be applied to the oldest possible branch. | + | versions. For example: **7.4**, **8.0**, **8.1** and **master**. A patch will be applied to the oldest possible branch. |
- | If the Release Manager of 5.6 accepts the change, commit it to the 5.6 branch. We will use regular merging between the release branches. | + | If the Release Manager of 7.4 accepts the change, commit it to the 7.4 branch. We will use regular merging between the release branches. |
Bigger features can use feature branches, but developers are encouraged to fork php on github and start implementing the | Bigger features can use feature branches, but developers are encouraged to fork php on github and start implementing the | ||
feature there on the respective branch. | feature there on the respective branch. | ||
Line 23: | Line 23: | ||
Let's go through the process of setting it up and doing the merges. | Let's go through the process of setting it up and doing the merges. | ||
- | ==== Developing Patches Yourself | + | ==== Initial Setup ==== |
- | The initial setup: | + | |
- | + | $ cd php-src | |
- | | + | $ git config merge.NEWS.name "Keep the NEWS file" |
+ | $ git config merge.NEWS.driver 'touch %A' | ||
+ | $ git config merge.log true | ||
| | ||
Please refer to [[gitfaq|Git FAQ]] for alternative cloning methods via HTTP or the Git Protocol. | Please refer to [[gitfaq|Git FAQ]] for alternative cloning methods via HTTP or the Git Protocol. | ||
- | Then: | + | ==== Patching a release branch ==== |
- | + | ||
- | $ cd php-src | + | |
- | $ git checkout -b PHP-7.2 origin/ | + | |
- | $ git checkout -b PHP-7.3 origin/ | + | |
- | $ git checkout -b PHP-7.4 origin/ | + | |
- | Patching the PHP 7.2 branch | + | Patching the PHP 7.4 branch: |
- | $ git checkout PHP-7.2 | + | $ git checkout PHP-7.4 |
... hack hack ... | ... hack hack ... | ||
$ git commit <changed files> | $ git commit <changed files> | ||
... USE A GOOD COMMIT MESSAGE ... | ... USE A GOOD COMMIT MESSAGE ... | ||
... run tests ... | ... run tests ... | ||
- | $ git checkout PHP-7.3 | + | $ git checkout PHP-8.0 |
- | $ git merge --no-ff --log PHP-7.2 | + | $ git merge PHP-7.4 |
... run tests ... | ... run tests ... | ||
- | $ git checkout PHP-7.4 | + | $ git checkout PHP-8.1 |
- | $ git merge --no-ff --log PHP-7.3 | + | $ git merge PHP-8.0 |
+ | ... run tests ... | ||
+ | $ git checkout PHP-8.2 | ||
+ | $ git merge PHP-8.1 | ||
... run tests ... | ... run tests ... | ||
$ git checkout master | $ git checkout master | ||
- | $ git merge --no-ff --log PHP-7.4 | + | $ git merge PHP-8.2 |
... run tests ... | ... run tests ... | ||
$ gitk master | $ gitk master | ||
... review the merges ... | ... review the merges ... | ||
- | $ git push origin | + | $ git push --atomic |
... push to the official repository ... | ... push to the official repository ... | ||
| | ||
When you use 'git push --all origin', | When you use 'git push --all origin', | ||
+ | |||
+ | Use the ' | ||
==== Reviewing and closing pull requests ==== | ==== Reviewing and closing pull requests ==== | ||
+ | |||
Johannes has created a [[http:// | Johannes has created a [[http:// | ||
+ | |||
+ | You can also include '' | ||
==== Merge a pull request ==== | ==== Merge a pull request ==== | ||
- | Preferably, pull requests should not be merged, but rebased onto the target branch. Because it is common that PRs need to be applied to a different branch than the one it was originally created for, the easiest way to do this is using '' | + | Preferably, pull requests should not be merged, but rebased onto the target branch. Because it is common that PRs need to be applied to a different branch than the one it was originally created for, the easiest way to do this is using '' |
- | $ git checkout PHP-7.2 | + | $ git checkout PHP-7.4 |
$ wget https:// | $ wget https:// | ||
$ git am -3 1234.patch | $ git am -3 1234.patch | ||
+ | $ git commit --am # Adjust commit message to add " | ||
... REVIEW IT ... | ... REVIEW IT ... | ||
$ make test | $ make test | ||
.. you better not forget that ... | .. you better not forget that ... | ||
- | $ git checkout PHP-7.3 | + | $ git checkout PHP-8.0 |
- | $ git merge --no-ff --log PHP-7.2 | + | $ git merge PHP-7.4 |
$ make test | $ make test | ||
- | $ git checkout PHP-7.4 | + | $ git checkout PHP-8.1 |
- | $ git merge --no-ff --log PHP-7.3 | + | $ git merge PHP-8.0 |
$ make test | $ make test | ||
$ git checkout master | $ git checkout master | ||
- | $ git merge --no-ff --log PHP-7.4 | + | $ git merge PHP-8.1 |
$ make test | $ make test | ||
- | $ git push origin PHP-7.2 PHP-7.3 PHP-7.4 master | + | $ git push origin PHP-7.4 PHP-8.0 PHP-8.1 master |
Additionally, | Additionally, | ||
| | ||
=== Note about moving patches from a newer branch === | === Note about moving patches from a newer branch === | ||
- | In case you have to merge a commit from a higher branch. E.g from PHP-7.3 into PHP-7.2 make sure you still merge upwards | + | In case you have to merge a commit from a higher branch. E.g from PHP-8.1 into PHP-7.4 make sure you still merge upwards |
as described above afterward: | as described above afterward: | ||
- | $ git checkout PHP-7.2 | ||
- | $ git cherry-pick < | ||
- | $ git checkout PHP-7.3 | ||
- | $ git merge --no-ff --log PHP-7.2 | ||
$ git checkout PHP-7.4 | $ git checkout PHP-7.4 | ||
- | $ git merge --no-ff --log PHP-7.3 | + | $ git cherry-pick <SHA1-OF-PATCH-TO-MOVE> |
+ | $ git checkout PHP-8.0 | ||
+ | $ git merge PHP-7.4 | ||
+ | $ git checkout PHP-8.1 | ||
+ | $ git merge PHP-8.0 | ||
$ git checkout master | $ git checkout master | ||
- | $ git merge --no-ff --log PHP-7.4 | + | $ git merge PHP-8.1 |
$ git push | $ git push | ||
- | **TL;DR: Always try to merge PHP-7.2 into PHP-7.3, then PHP-7.4, and then into master.** | + | **TL;DR: Always try to merge PHP-7.4 into PHP-8.0, then PHP-8.1, and then into master.** |
==== Merge patches received per mail ==== | ==== Merge patches received per mail ==== | ||
Line 130: | Line 136: | ||
$ git rebase master | $ git rebase master | ||
| | ||
- | Once the feature is accepted merge it into master: | + | Once the feature is accepted, make sure your branch is up to date (see above) and then fast-forward |
$ git checkout master | $ git checkout master | ||
- | $ git merge --no-ff --log feature/ | + | $ git merge --ff-only feature/ |
===== Workflow for external contributors ===== | ===== Workflow for external contributors ===== | ||
Line 145: | Line 151: | ||
$ git remote add upstream https:// | $ git remote add upstream https:// | ||
$ git fetch upstream | $ git fetch upstream | ||
- | $ git branch --track issue-< | + | $ git branch --track issue-< |
$ git checkout issue-< | $ git checkout issue-< | ||
Do your stuff and add/commit your work accordingly. | Do your stuff and add/commit your work accordingly. | ||
Optionally, you can rebase your work: | Optionally, you can rebase your work: | ||
- | $ git pull --rebase upstream PHP-7.2 (or use upstream master) | + | $ git pull --rebase upstream PHP-7.4 (or use upstream master) |
Push your branch to your github repository: | Push your branch to your github repository: | ||
$ git push origin issue-< | $ git push origin issue-< | ||
Line 167: | Line 173: | ||
If you prefer mail use git format-patch and send the created patch using mail: | If you prefer mail use git format-patch and send the created patch using mail: | ||
- | $ git format-patch origin/ | + | $ git format-patch origin/ |
0001-bug-fix.patch | 0001-bug-fix.patch | ||
... | ... | ||
Line 176: | Line 182: | ||
| | ||
If you don't have an issue-number, | If you don't have an issue-number, | ||
- | As stated before, branch from the lowest version possible. When you want to create a patch that needs to be incorporated into several branches, like a security fix for something in PHP-7.1, PHP-7.2, PHP-7.3, PHP-7.4 | + | As stated before, branch from the lowest version possible. When you want to create a patch that needs to be incorporated into several branches, like a security fix for something in PHP-7.4, PHP-8.0, PHP-8.1, and the master, make sure you checkout a branch from PHP-7.4. You don't need to create separate pull requests for PHP-7.4, PHP-8.0, PHP-8.1, and master. |
vcs/gitworkflow.1548669674.txt.gz · Last modified: 2019/01/28 10:01 by nikic