1 |
Andreas K. Huettel: |
2 |
>> |
3 |
>> However, rebasing changes *on* master, before they are pushed, is a good |
4 |
>> thing, because that kills non-fast-forward merges. |
5 |
>> |
6 |
> |
7 |
> Nontrivial rebases *on* master can be problematic because you're changing |
8 |
> history. |
9 |
> |
10 |
> Imagine you pull some nice commits from a user. Then at some point you will |
11 |
> have to rebase them before you push them. If this fails and requires manual |
12 |
> interaction, the original version of the commits is lost (including |
13 |
> signatures) and errors are not traceable. |
14 |
> |
15 |
> With a merge instead any manual intervention is clearly located in the merge |
16 |
> commit and the authors of each change are uniquely identifiable. |
17 |
> |
18 |
|
19 |
So, I've tried to come up with a more detailed approach. Some people |
20 |
mentioned that we maybe shouldn't do rebases at all, because git already |
21 |
does trivial rebases automatically, but I'd try with them first. |
22 |
|
23 |
|
24 |
== commit policy == |
25 |
|
26 |
* atomic commits (one logical change) |
27 |
* commits may span across multiple ebuilds/directories if it's one |
28 |
logical change |
29 |
* every commit on the first parent of the history must be gpg signed by |
30 |
a gentoo dev |
31 |
* repoman must be run from all related directories (or the top-level |
32 |
directory) on the latest commit that is being pushed |
33 |
|
34 |
=== commit message format === |
35 |
* all lines max 70-75 chars |
36 |
* first line brief explanation |
37 |
* second line always empty |
38 |
* optional detailed multiline explanation must start at the third line |
39 |
* for commits that affect only a single package, prepend |
40 |
"CATEGORY/PN: " to the first line |
41 |
* for commits that affect only the profile directory, prepend |
42 |
"profiles: " to the first line |
43 |
* for commits that affect only the eclass directory, prepend |
44 |
"ECLASSNAME.eclass: " to the first line |
45 |
* for commits that affect only licenses directory, prepend |
46 |
"licenses: " to the first line |
47 |
* for commits that affect only metadata directory, prepend |
48 |
"metadata: " to the first line |
49 |
|
50 |
== branching model == |
51 |
|
52 |
* the primary production-ready branch is master (users will pull from |
53 |
here), there are no non-fast-forward pushes allowed |
54 |
* there may be developer-specific, task-specific, project-specific |
55 |
branches etc (there are currently no specific rules about them) |
56 |
|
57 |
=== when/how to rebase === |
58 |
|
59 |
* in case of a non-fast-forward push conflict to remote master, try |
60 |
'git pull --rebase=preserve' first, if that yields complicated |
61 |
conflicts, abort the rebase and continue with a regular merge |
62 |
* use --preserve to preserve merges during a rebase (if appropriate, |
63 |
e.g. for user branches) |
64 |
* don't use --preserve if you do an interactive rebase (see BUGS in |
65 |
git-rebase manpage) |
66 |
* commits that are not on the remote master branch yet may be |
67 |
rewritten/squashed/splitted etc via interactive rebase, however the |
68 |
rebase must never span beyond those commits |
69 |
* never rebase on already pushed commits |
70 |
* there are no particular rules for rebasing on non-master remote |
71 |
branches, but be aware that others might base their work on them |
72 |
* there are no particular rules for rebasing non-remote branches, as |
73 |
long as they don't clutter the history when merged back into master |
74 |
* don't do complicated rebases to avoid a merge commit at all cost (it |
75 |
may even cause losing information, e.g. user signatures) |
76 |
|
77 |
=== when/how to merge === |
78 |
|
79 |
* if a rebase fails or is too complicated, do a regular merge instead |
80 |
* if the information is useful (e.g. pulled from a foreign remote user |
81 |
branch or merged a non-trivial eclass conversion back into master) |
82 |
force a merge commit (non-fast-forward merge via '--no-ff') |
83 |
* to avoid a merge commit (e.g. information is not useful), you may try |
84 |
to force a fast-forward merge by first rebasing the feature branch |
85 |
(or similar) against master and then merging it into master |
86 |
* extend merge commit messages with useful information, e.g. how |
87 |
conflicts were solved |
88 |
* keep in mind that all commits of the first parent of the history must |
89 |
be gpg signed by a gentoo dev, so you may want to force merge commits |
90 |
especially for user branches |
91 |
|
92 |
== remote model == |
93 |
|
94 |
We have a main developer repo where developers work & commit (every |
95 |
developer has direct push access). For every push into developer repo, |
96 |
automated magic thingie merges stuff into user sync repo and updates the |
97 |
metadata cache there. |
98 |
|
99 |
User sync repo is for power users than want to fetch via git. It's quite |
100 |
fast and efficient for frequent updates, and also saves space by being |
101 |
free of ChangeLogs. |
102 |
|
103 |
On top of user sync repo rsync is propagated. The rsync tree is |
104 |
populated with all old ChangeLogs copied from CVS (stored in 30M git |
105 |
repo), new ChangeLogs are generated from git logs and Manifests are |
106 |
expanded. |