Skip to content

Commit b23fa08

Browse files
Merge pull request #6 from arjunrn/add-rebase-doc
UPSTREAM: <carry>: Add document with procedure for rebasing
2 parents bdf62d2 + 6617f8a commit b23fa08

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

rebase.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Rebasing Procedure
2+
3+
This fork needs to be periodically synced with upstream changes. To do this we
4+
need to run the following steps:
5+
6+
1. Ensure the *upstream*, *downstream* and your own fork of the repository are
7+
configured correctly as remotes.
8+
```bash
9+
git remote -v
10+
# if upstream or downstream are not present then add them
11+
git remote add upstream https://github.com/kubernetes-sigs/aws-load-balancer-controller
12+
git remote add downstream https://github.com/openshift/aws-load-balancer-controller
13+
```
14+
15+
2. Ensure that the `main` branch is up-to-date with the *downstream* `main`
16+
branch.
17+
```bash
18+
git switch main
19+
git pull downstream main
20+
```
21+
22+
3. Update the remotes
23+
```bash
24+
git remote update
25+
```
26+
27+
4. Checkout the commit from upstream to which you want to rebase the `main`
28+
branch.
29+
```bash
30+
git checkout $TAG_OR_COMMIT_ID
31+
git switch -c rebase
32+
```
33+
34+
5. Merge the `main` branch into the current branch with
35+
the [ours](https://git-scm.com/docs/merge-strategies#_merge_strategies)
36+
merge strategy.
37+
```bash
38+
git merge -s ours main
39+
```
40+
_Note:_ This strategy should not be confused with the `ours` option for
41+
the `ort` merge strategy.
42+
43+
7. Determine the changes present in the `main` branch which need to be
44+
cherry-picked.
45+
```bash
46+
git log --oneline --no-merges $TAG_OR_COMMIT_ID..main
47+
```
48+
49+
## Message format for cherry-picked commits
50+
51+
The commits which are cherry-picked into the rebase branch should have the
52+
following format:
53+
54+
* `UPSTREAM: <carry>: $MESSAGE`
55+
A persistent carry that should probably be picked for the subsequent rebase
56+
branch. In general, these commits are used to modify behavior from upstream.
57+
58+
* `UPSTREAM: <drop>: $MESSAGE`
59+
A carry that should probably not be picked for the subsequent rebase branch.
60+
In general, these commits are used to maintain the codebase in ways that are
61+
branch-specific, like the update of generated files or dependencies.
62+
63+
* `UPSTREAM: 77870: $MESSAGE`
64+
The number identifies a PR in the upstream repository(
65+
i.e. https://github.com/kubernetes-sigs/aws-load-balancer-controller/pull/<pr_id>)
66+
A commit with this message should only be picked into the subsequent rebase
67+
branch if the commits of the referenced PR are not included in the upstream
68+
branch. To check if a given commit is included in the upstream branch, open
69+
the referenced upstream PR and check any of its commits for the release tag (
70+
e.g. v.1.20.0) targeted by the new rebase branch.
71+
72+

0 commit comments

Comments
 (0)