README.md

  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`).
 39If your distribution doesn't have packages of Rust and Cargo, or has an
 40outdated version (which may result in build errors), you can [download the
 41stable version of Rust and Cargo from the rust-lang.org download
 42page](https://www.rust-lang.org/downloads.html).
 43
 44With Rust and Cargo installed, you can download and install the latest release
 45of git-series with:
 46
 47```
 48cargo install --root ~/.local git-series
 49```
 50
 51This will install git-series into `~/.local/bin/git-series`.  If you don't
 52already have `~/.local/bin` on your `$PATH`, you may want to add it there, or
 53change the `--root`.  You may also want to install the included manpage,
 54`git-series.1`, into `~/.local/share/man/man1/git-series.1`.
 55
 56If you'd like to package git-series for your distribution, please contact me.
 57
 58Overview of commands
 59====================
 60
 61- Use `git series start seriesname` to start a patch series seriesname.
 62
 63- Use `git series base somecommit` to set the base commit for the series.
 64  (This is the upstream commit you based the series on, not the first patch in
 65  the series.)
 66
 67- Use normal git commands to commit changes.
 68
 69- Use `git series status` to check what has changed.
 70
 71- Use `git series cover` to add or edit a cover letter.
 72
 73- Use `git series rebase -i` to help rework or reorganize the patch series.
 74
 75- Use `git series add` and `git series commit` (or `git series commit -a`) to
 76  commit changes to the patch series.  You can do this whenever you've changed
 77  the base or cover letter, or whenever you've changed HEAD to a new commit.
 78  Make a series commit whenever you've made a semantic change to the patch
 79  series that you want to record, such as rebasing on a new upstream version,
 80  reorganizing patches, or incorporating feedback.
 81
 82- Use `git series format` to prepare the patch series to send via email, or
 83  use `git series req` to prepare a "please pull" mail (after pushing the
 84  changes to a repository as a branch or tag).
 85
 86Workflow example
 87================
 88
 89Suppose you want to write a patch series implementing a new feature for a
 90project.  You already have a local `git clone` of the repository.  You could
 91start a branch for this patch series, but it may take multiple iterations
 92before upstream accepts it, and you may need to use rebase or amend to fix
 93commits; a branch can't track that.  With git-series, you'll develop the patch
 94series as you normally would, including rebases, and periodically `git series
 95commit` the state of the patch series, complete with a commit message
 96explaining what you've changed.  Even if you rebase the patch series, or make
 97some other change that doesn't fast-forward, git-series will track those
 98changes with a branch that *does* fast-forward, so you can easily share and
 99review the history of your patch series.
100
101Developing or importing the first version
102-----------------------------------------
103
104To start the patch series, first run `git series start featurename`.
105`featurename` here specifies the name for the series, just as you'd specify the
106name of a branch.
107
108A patch series needs some base to build on, identifying the upstream commit you
109want to develop from.  This will become the parent of the first patch in your
110series.  If you want to base your patch series on the current version, run `git
111series base HEAD`.  If you want to base this patch series on some other commit,
112such as a released version, first check out that commit with `git checkout
113thecommit`, then run `git series base HEAD`.
114
115You can then develop the patch series as usual, committing patches with git.
116
117If you've already started on the patch series and made some commits, you can
118still adopt the current version of the patch series into git-series.  Find the
119parent commit of the first patch in your series, and run `git series base
120thatcommit`.
121
122As with `git`, you can run `git series status` at any time to see the current
123state of the series, including changes you might want to commit, and the next
124step to run.  After the above steps, `git series status` should show `base` and
125`series` modified; running `git series base` set the `base` in the "working"
126version, and `series` in the working version always refers to HEAD (the current
127git commit you have checked out).
128
129Now that you've written an initial version of the patch series (or you already
130wrote it before you started using git-series), you can commit that version to
131git-series.  Run `git series commit -a` to commit the series.  This will run
132your editor so you can provide a series commit message (e.g. "Initial version
133of feature" or "Import feature into git-series").
134
135If your patch series include multiple patches, you may want to add a cover
136letter.  Run `git series cover` to edit the cover letter, then `git series
137commit -a -m 'Add cover letter'` to commit that change to the series.
138
139Now that you have the first version of the patch series, you can format it as a
140series of emails with `git series format`.
141
142Developing v2
143-------------
144
145You send the patch series by email, and you get feedback from the maintainers:
146the concept looks good, but you need to split one of the patches into two, and
147add benchmark results in another commit's commit message.
148
149Run `git series rebase -i`, and split the commit (mark it for 'e'dit, `git
150reset -N HEAD^`, repeatedly `git add -p` and `git commit`, then `git rebase
151--continue`).  Then, commit that change to the series: `git series commit -a -m
152'Split out X change into a separate patch'`
153
154Then, run `git series rebase -i` again to add the benchmark results (mark the
155commit for 'r'eword), and commit that change: `git series commit -a -m 'Add
156benchmark results'`.
157
158You may want to document the changes in the cover letter: run `git series
159cover`, document the changes, and `git series commit -a -m 'Update cover letter
160for v2'`.  (Alternatively, you can incrementally add to the cover letter along
161with each change to the series.)
162
163Now that you have v2 of the patch series, you can format it as a new series of
164emails with `git series format -v 2`.