Changeset View
Changeset View
Standalone View
Standalone View
documentation/content/en/articles/committers-guide/_index.adoc
| Show First 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | |||||
| Most people will want to do a deep clone of the repository. | Most people will want to do a deep clone of the repository. | ||||
| However, there are times when you may wish to do a shallow clone. | However, there are times when you may wish to do a shallow clone. | ||||
| ===== Branch Names | ===== Branch Names | ||||
| FreeBSD-CURRENT uses the `main` branch. | FreeBSD-CURRENT uses the `main` branch. | ||||
| `main` is the default branch. | `main` is the default branch. | ||||
| For FreeBSD-STABLE, branch names include `stable/12` and `stable/13`. | For FreeBSD-STABLE, branch names include `stable/{rel-latest-major}` and `stable/{rel-legacy-major}`. | ||||
| For FreeBSD-RELEASE, release engineering branch names include `releng/12.4` and `releng/13.2`. | For FreeBSD-RELEASE, release engineering branch names include `releng/{rel-latest}` and `releng/{rel-legacy}`. | ||||
| https://www.freebsd.org/releng/[] shows: | https://www.freebsd.org/releng/[] shows: | ||||
| * `main` and `stable/⋯` branches open | * `main` and `stable/⋯` branches open | ||||
| * `releng/⋯` branches, each of which is frozen when a release is tagged. | * `releng/⋯` branches, each of which is frozen when a release is tagged. | ||||
| Examples: | Examples: | ||||
| * tag https://cgit.freebsd.org/src/tag/?h=release/13.1.0[release/13.1.0] on the https://cgit.freebsd.org/src/log/?h=releng/13.1[releng/13.1] branch | * tag https://cgit.freebsd.org/src/tag/?h=release/{rel-latest}.0[release/{rel-latest}.0] on the https://cgit.freebsd.org/src/log/?h=releng/{rel-latest}[releng/{rel-latest}] branch | ||||
| * tag https://cgit.freebsd.org/src/tag/?h=release/13.2.0[release/13.2.0] on the https://cgit.freebsd.org/src/log/?h=releng/13.2[releng/13.2] branch. | * tag https://cgit.freebsd.org/src/tag/?h=release/{rel-legacy}.0[release/{rel-legacy}.0] on the https://cgit.freebsd.org/src/log/?h=releng/{rel-legacy}[releng/{rel-legacy}] branch. | ||||
| ===== Repositories | ===== Repositories | ||||
| Please see the crossref:committers-guide[admin,Administrative Details] for the latest information on where to get FreeBSD sources. | Please see the crossref:committers-guide[admin,Administrative Details] for the latest information on where to get FreeBSD sources. | ||||
| $URL below can be obtained from that page. | $URL below can be obtained from that page. | ||||
| Note: The project doesn't use submodules as they are a poor fit for our workflows and development model. | Note: The project doesn't use submodules as they are a poor fit for our workflows and development model. | ||||
| How we track changes in third-party applications is discussed elsewhere and generally of little concern to the casual user. | How we track changes in third-party applications is discussed elsewhere and generally of little concern to the casual user. | ||||
| ▲ Show 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | |||||
| git rebase --abort will take you back to a clean slate. | git rebase --abort will take you back to a clean slate. | ||||
| It is important, though, to start with an unmodified tree. | It is important, though, to start with an unmodified tree. | ||||
| An aside: The above mentioned `git reflog` comes in handy here, as it will have a list of all the (intermediate) commits that you can view or inspect or cherry-pick. | An aside: The above mentioned `git reflog` comes in handy here, as it will have a list of all the (intermediate) commits that you can view or inspect or cherry-pick. | ||||
| For more on this topic, https://www.freecodecamp.org/news/the-ultimate-guide-to-git-merge-and-git-rebase/ provides a rather extensive treatment. | For more on this topic, https://www.freecodecamp.org/news/the-ultimate-guide-to-git-merge-and-git-rebase/ provides a rather extensive treatment. | ||||
| It is a good resource for issues that arise occasionally but are too obscure for this guide. | It is a good resource for issues that arise occasionally but are too obscure for this guide. | ||||
| ===== Switching to a Different FreeBSD Branch | ===== Switching to a Different FreeBSD Branch | ||||
| If you wish to shift from stable/12 to the current branch. | If you wish to shift from stable/{rel-latest-major} to the current branch. | ||||
| If you have a deep clone, the following will suffice: | If you have a deep clone, the following will suffice: | ||||
| [source,shell] | [source,shell] | ||||
| .... | .... | ||||
| % git checkout main | % git checkout main | ||||
| % # build and install here... | % # build and install here... | ||||
| .... | .... | ||||
| If you have a local branch, though, there are one or two caveats. | If you have a local branch, though, there are one or two caveats. | ||||
| First, rebase will rewrite history, so you will likely want to do something to save it. | First, rebase will rewrite history, so you will likely want to do something to save it. | ||||
| Second, jumping branches tends to cause more conflicts. | Second, jumping branches tends to cause more conflicts. | ||||
| If we pretend the example above was relative to stable/12, then to move to `main`, I'd suggest the following: | If we pretend the example above was relative to stable/{rel-latest-major}, then to move to `main`, I'd suggest the following: | ||||
| [source,shell] | [source,shell,subs=attributes] | ||||
| .... | .... | ||||
| % git checkout no-color-ls | % git checkout no-color-ls | ||||
| % git checkout -b no-color-ls-stable-12 # create another name for this branch | % git checkout -b no-color-ls-stable-{rel-latest-major} # create another name for this branch | ||||
| % git rebase -i stable/12 no-color-ls --onto main | % git rebase -i stable/{rel-latest-major} no-color-ls --onto main | ||||
| .... | .... | ||||
| What the above does is checkout no-color-ls. | What the above does is checkout no-color-ls. | ||||
| Then create a new name for it (no-color-ls-stable-12) in case you need to get back to it. | Then create a new name for it (`no-color-ls-stable-{rel-latest-major}`) in case you need to get back to it. | ||||
| Then you rebase onto the `main` branch. | Then you rebase onto the `main` branch. | ||||
| This will find all the commits to the current no-color-ls branch (back to where it meets up with the stable/12 branch) and then it will | This will find all the commits to the current no-color-ls branch (back to where it meets up with the stable/{rel-latest-major} branch) and then it will | ||||
| replay them onto the `main` branch creating a new no-color-ls branch there (which is why I had you create a place holder name). | replay them onto the `main` branch creating a new no-color-ls branch there (which is why I had you create a place holder name). | ||||
| [[mfc-with-git]] | [[mfc-with-git]] | ||||
| === MFC (Merge From Current) Procedures | === MFC (Merge From Current) Procedures | ||||
| ==== Summary | ==== Summary | ||||
| MFC workflow can be summarized as `git cherry-pick -x` plus `git commit --amend` to adjust the commit message. | MFC workflow can be summarized as `git cherry-pick -x` plus `git commit --amend` to adjust the commit message. | ||||
| For multiple commits, use `git rebase -i` to squash them together and edit the commit message. | For multiple commits, use `git rebase -i` to squash them together and edit the commit message. | ||||
| ==== Single commit MFC | ==== Single commit MFC | ||||
| [source,shell] | [source,shell,subs=attributes] | ||||
| .... | .... | ||||
| % git checkout stable/X | % git checkout stable/{rel-latest-major} | ||||
| % git cherry-pick -x $HASH --edit | % git cherry-pick -x $HASH --edit | ||||
| .... | .... | ||||
| For MFC commits, for example a vendor import, you would need to specify one parent for cherry-pick purposes. | For MFC commits, for example a vendor import, you would need to specify one parent for cherry-pick purposes. | ||||
| Normally, that would be the "first parent" of the branch you are cherry-picking from, so: | Normally, that would be the "first parent" of the branch you are cherry-picking from, so: | ||||
| [source,shell] | [source,shell,subs=attributes] | ||||
| .... | .... | ||||
| % git checkout stable/X | % git checkout stable/{rel-latest-major} | ||||
| % git cherry-pick -x $HASH -m 1 --edit | % git cherry-pick -x $HASH -m 1 --edit | ||||
| .... | .... | ||||
| If things go wrong, you'll either need to abort the cherry-pick with `git cherry-pick --abort` or fix it up and do a `git cherry-pick --continue`. | If things go wrong, you'll either need to abort the cherry-pick with `git cherry-pick --abort` or fix it up and do a `git cherry-pick --continue`. | ||||
| Once the cherry-pick is finished, push with `git push`. | Once the cherry-pick is finished, push with `git push`. | ||||
| If you get an error due to losing the commit race, use `git pull --rebase` and try to push again. | If you get an error due to losing the commit race, use `git pull --rebase` and try to push again. | ||||
| ==== MFC to RELENG branch | ==== MFC to RELENG branch | ||||
| MFCs to branches that require approval require a bit more care. | MFCs to branches that require approval require a bit more care. | ||||
| The process is the same for either a typical merge or an exceptional direct commit. | The process is the same for either a typical merge or an exceptional direct commit. | ||||
| * Merge or direct commit to the appropriate `stable/X` branch first before merging to the `releng/X.Y` branch. | * Merge or direct commit to the appropriate `stable/X` branch first before merging to the `releng/X.Y` branch. | ||||
| * Use the hash that's in the `stable/X` branch for the MFC to `releng/X.Y` branch. | * Use the hash that's in the `stable/X` branch for the MFC to `releng/X.Y` branch. | ||||
| * Leave both "cherry picked from" lines in the commit message. | * Leave both "cherry picked from" lines in the commit message. | ||||
| * Be sure to add the `Approved by:` line when you are in the editor. | * Be sure to add the `Approved by:` line when you are in the editor. | ||||
| [source,shell] | [source,shell,subs=attributes] | ||||
| .... | .... | ||||
| % git checkout releng/13.0 | % git checkout releng/{rel-latest-next} | ||||
| % git cherry-pick -x $HASH --edit | % git cherry-pick -x $HASH --edit | ||||
| .... | .... | ||||
| If you forget to add the `Approved by:` line, you can do a `git commit --amend` to edit the commit message before you push the change. | If you forget to add the `Approved by:` line, you can do a `git commit --amend` to edit the commit message before you push the change. | ||||
ziaee: This entire `MFC to RELENG` subsection should be replaced with the current instructions for… | |||||
| ==== Multiple commit MFC | ==== Multiple commit MFC | ||||
| [source,shell] | [source,shell] | ||||
| .... | .... | ||||
| % git checkout -b tmp-branch stable/X | % git checkout -b tmp-branch stable/X | ||||
| % for h in $HASH_LIST; do git cherry-pick -x $h; done | % for h in $HASH_LIST; do git cherry-pick -x $h; done | ||||
| % git rebase -i stable/X | % git rebase -i stable/X | ||||
| # mark each of the commits after the first as 'squash' | # mark each of the commits after the first as 'squash' | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| % git cherry-pick -x -m 2 $HASH | % git cherry-pick -x -m 2 $HASH | ||||
| .... | .... | ||||
| to do that. The `--abort` will cleanup the failed first attempt. | to do that. The `--abort` will cleanup the failed first attempt. | ||||
| ==== Redoing a MFC | ==== Redoing a MFC | ||||
| If you do a MFC, and it goes horribly wrong and you want to start over, | If you do a MFC, and it goes horribly wrong and you want to start over, | ||||
| then the easiest way is to use `git reset --hard` like so: | then the easiest way is to use `git reset --hard` like so: | ||||
| [source,shell] | [source,shell,subs=attributes] | ||||
| .... | .... | ||||
| % git reset --hard freebsd/stable/12 | % git reset --hard freebsd/stable/{rel-latest-major} | ||||
| .... | .... | ||||
| though if you have some revs you want to keep, and others you don't, | though if you have some revs you want to keep, and others you don't, | ||||
| using `git rebase -i` is better. | using `git rebase -i` is better. | ||||
| ==== Considerations when MFCing | ==== Considerations when MFCing | ||||
| When committing source commits to stable and releng branches, we have the following goals: | When committing source commits to stable and releng branches, we have the following goals: | ||||
| ▲ Show 20 Lines • Show All 2,824 Lines • Show Last 20 Lines | |||||
This entire MFC to RELENG subsection should be replaced with the current instructions for asking @cperciva to MFC something, right? I know that's on the wiki somewhere but I can not find it by searching the wiki for "release" or "mfc". If we agree on that, I can do that in a followup commit?