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