1git series tracks changes to a patch series over time. git series also tracks
2a cover letter for the patch series, formats the series for email, and prepares
3pull requests.
4
5About git-series
6================
7
8A patch series typically goes through multiple iterations before submission;
9the path from idea to RFC to `[PATCHv12 1/8]` includes many invocations of
10`git rebase -i`. However, while Git tracks and organizes commits quite well, it
11doesn't actually track changes to a patch series at all, outside of the
12ephemeral reflog. This makes it a challenge to collaborate on a patch series,
13distribution package, backport, or any other development process that includes
14rebasing or non-fast-forward development.
15
16Typically, tracking the evolution of a patch series over time involves moving
17part of the version control outside of git. You can move the patch series from
18git into quilt or a distribution package, and then version the patch files with
19git, losing the power of git's tools. Or, you can keep the patch series in
20git, and version it via multiple named branches; however, names like
21feature-v2, feature-v3-typofix, and feature-v8-rebased-4.6-alice-fix sound like
22filenames from corporate email, not modern version control. And either way,
23git doesn't track your cover letter at all.
24
25git-series tracks both a patch series and its evolution within the same git
26repository. git-series works entirely with existing git features, allowing git
27to push and pull a series to any git repository along with other branches and
28tags. git-series also tracks a cover letter for the patch series, formats the
29series for email, and prepares pull requests.
30
31Building and installing
32=======================
33
34git-series is written in Rust. You'll need both Rust and Cargo installed to
35build it. If your OS distribution includes packages for Rust and Cargo, start
36by installing those (for instance, on Debian, `apt install rustc cargo`).
37Otherwise, you can [download the stable version of Rust and Cargo from the
38rust-lang.org download page](https://www.rust-lang.org/downloads.html).
39
40With Rust and Cargo installed, you can download and install the latest release
41of git-series with:
42
43```
44cargo install --root ~/.local git-series
45```
46
47This will install git-series into `~/.local/bin/git-series`. If you don't
48already have `~/.local/bin` on your `$PATH`, you may want to add it there, or
49change the `--root`. You may also want to install the included manpage,
50`git-series.1`, into `~/.local/share/man/man1/git-series.1`.
51
52If you'd like to package git-series for your distribution, please contact me.
53
54Overview of commands
55====================
56
57- Use `git series start seriesname` to start a patch series seriesname.
58
59- Use `git series base somecommit` to set the base commit for the series.
60 (This is the upstream commit you based the series on, not the first patch in
61 the series.)
62
63- Use normal git commands to commit changes.
64
65- Use `git series status` to check what has changed.
66
67- Use `git series cover` to add or edit a cover letter.
68
69- Use `git series rebase -i` to help rework or reorganize the patch series.
70
71- Use `git series add` and `git series commit` (or `git series commit -a`) to
72 commit changes to the patch series. You can do this whenever you've changed
73 the base or cover letter, or whenever you've changed HEAD to a new commit.
74 Make a series commit whenever you've made a semantic change to the patch
75 series that you want to record, such as rebasing on a new upstream version,
76 reorganizing patches, or incorporating feedback.
77
78- Use `git series format` to prepare the patch series to send via email, or
79 use `git series req` to prepare a "please pull" mail (after pushing the
80 changes to a repository as a branch or tag).
81
82Workflow example
83================
84
85Suppose you want to write a patch series implementing a new feature for a
86project. You already have a local `git clone` of the repository. You could
87start a branch for this patch series, but it may take multiple iterations
88before upstream accepts it, and you may need to use rebase or amend to fix
89commits; a branch can't track that. With git-series, you'll develop the patch
90series as you normally would, including rebases, and periodically `git series
91commit` the state of the patch series, complete with a commit message
92explaining what you've changed. Even if you rebase the patch series, or make
93some other change that doesn't fast-forward, git-series will track those
94changes with a branch that *does* fast-forward, so you can easily share and
95review the history of your patch series.
96
97Developing or importing the first version
98-----------------------------------------
99
100To start the patch series, first run `git series start featurename`.
101`featurename` here specifies the name for the series, just as you'd specify the
102name of a branch.
103
104A patch series needs some base to build on, identifying the upstream commit you
105want to develop from. This will become the parent of the first patch in your
106series. If you want to base your patch series on the current version, run `git
107series base HEAD`. If you want to base this patch series on some other commit,
108such as a released version, first check out that commit with `git checkout
109thecommit`, then run `git series base HEAD`.
110
111You can then develop the patch series as usual, committing patches with git.
112
113If you've already started on the patch series and made some commits, you can
114still adopt the current version of the patch series into git-series. Find the
115parent commit of the first patch in your series, and run `git series base
116thatcommit`.
117
118As with `git`, you can run `git series status` at any time to see the current
119state of the series, including changes you might want to commit, and the next
120step to run. After the above steps, `git series status` should show `base` and
121`series` modified; running `git series base` set the `base` in the "working"
122version, and `series` in the working version always refers to HEAD (the current
123git commit you have checked out).
124
125Now that you've written an initial version of the patch series (or you already
126wrote it before you started using git-series), you can commit that version to
127git-series. Run `git series commit -a` to commit the series. This will run
128your editor so you can provide a series commit message (e.g. "Initial version
129of feature" or "Import feature into git-series").
130
131If your patch series include multiple patches, you may want to add a cover
132letter. Run `git series cover` to edit the cover letter, then `git series
133commit -a -m 'Add cover letter'` to commit that change to the series.
134
135Now that you have the first version of the patch series, you can format it as a
136series of emails with `git series format`.
137
138Developing v2
139-------------
140
141You send the patch series by email, and you get feedback from the maintainers:
142the concept looks good, but you need to split one of the patches into two, and
143add benchmark results in another commit's commit message.
144
145Run `git series rebase -i`, and split the commit (mark it for 'e'dit, `git
146reset -N HEAD^`, repeatedly `git add -p` and `git commit`, then `git rebase
147--continue`). Then, commit that change to the series: `git series commit -a -m
148'Split out X change into a separate patch'`
149
150Then, run `git series rebase -i` again to add the benchmark results (mark the
151commit for 'r'eword), and commit that change: `git series commit -a -m 'Add
152benchmark results'`.
153
154You may want to document the changes in the cover letter: run `git series
155cover`, document the changes, and `git series commit -a -m 'Update cover letter
156for v2'`. (Alternatively, you can incrementally add to the cover letter along
157with each change to the series.)
158
159Now that you have v2 of the patch series, you can format it as a new series of
160emails with `git series format -v 2`.