Package: git-pile
git-pileManage a pile of patches on top of a git branchRequirementsPython >= 3.7git >= 2.20Python modules:argcomplete (optional for shell completion)coverage (optional for tests)QuickstartRunning git-pilegit-pile follows the git naming convention for binaries so we can use it as a
subcommand to git. Either of the following forms work if the git-pile is in the
search PATH:$gitpile-h
$git-pile-hFor autocomplete to work you need Python's argcomplete module installed.
In the first case you also need to source the bash autocomplete fileextra/git-pile-complete.shso git knows how to complete the subcommand.You can also install git-pile as a python package, although that's still not
recommended since it's being updated frequently.$./setup.pyinstallOR$./setup.pyinstall--userIn case a--useroption is provided to the command above it will install
under$HOMEdirectory and bash completion file will be at$XDG_DATA_HOME/git-pile/bash_completion.  There isn't a standard user
directory for bash completion we can install to, so the user is expected to
source this file.Repository initializationInitialize a newemptypile:$gitpileinitNow you have a (orphan) pile branch to keep track of patch files to be managed
on top of the master branch. Branch names may be changed via options togit pile init. Likegit initcreates a new repository,git pile initwill
create a new pile.Alternatively, if the pile branch already exists in a remote repository (or
even locally) and you want to setup your work tree to use it you should use
the command below:$gitpilesetupinternal/pileinternal/embargo-branchIn the example above we have a remote calledinternalwhich has a branch
namedpilethat contains the patch files and a branch namedembargo-branchthat will be the branch being generated when we apply the patches.The second argument is optional and if not given the current branch will be
used.Develop a new commit and send to mailing listYou can use your normal git flow to develop changes in the project and create
commits. Here is an example that is by no means restricted to git-pile:$gitcheckout-bnewfeatureinternal/embargo-branch
$echo"platform 16">>platforms.txt
$gitaddplatforms.txt
$gitcommit"add new platform"Continuing from the initialization example, we create a new branch withinternal/embargo-branchas the base. The result can be prepared to send to a
mailing list in the same vein as howgit format-patchworks:$gitpileformat-patch-o/tmp/patches
/tmp/patches/0000-cover-letter.patch
/tmp/patches/0001-add-new-platform.patchThe cover letter will contain the diff to the pile branch (with patches added
and so on), while the patch files will also be available in isolation: those
are diffs to the result branch, and present to ease review.If the commit you are adding should not be on top, but rather in the middle
of the long running patch series, you can just move it down in the tree
withgit rebase -i. In the example below we will move it 10 commits down:$gitrebase-i-11[editoropensandyoumovethecommitaround.Youcanalsoreordercommits,editcommitmessage,etc,etc.Anythingyoudoinainteractiverebaseyoucandohere]$gitpileformat-patch-o/tmp/patches
/tmp/patches/0000-cover-letter.patch
/tmp/patches/0001-old-platform.patch
/tmp/patches/0002-old-platform-2.patch
/tmp/patches/0003-add-new-platform.patchAny patch that needs to be changed in order to accommodate the patch in the
middle of the series will be prepared bygit pile format-patch.Generate the pile from the changed treeInstead of sending to the mailing list, you can simply transform
the changes from the branch to the physical patches maintained
in the pile branch.$gitpilegenpatchesmaster..newfeature
$cdpatches
$gitadd-A
$gitcommit-m"add platform"$gitpilegenbranchThis generates the patches, saving the final state in the patch series, and
then recreatesembargo-branchlocally. Patches may be reordered, added in the
middle, reworded etc. By going through the genpatches + genbranch cycle we can
always re-generate the branch and keep the history of what was done, i.e.
maintain the history of how the patches were changed/added/removed.Apply a patch series to the pileThe cover-letter in a git-pile generated patch series (i.e. the one generated
bygit pile format-patch) always contain the diff of the original state of the
tree to the current state. It may be used to apply the entire series by
targeting the patches directory instead of the normal working directory.$# machine 2$cdpile
$gitam/tmp/patches/0000-cover-letter.patch
$gitgenbranchThis will apply the entire series that was received (even if it was a 10 patches
series, only the specially-formatted cover-letter needs to be applied).Destroying the pileIf anything goes wrong and you'd like to start over, you can call thedestroycommand. This will remove all configuration saved by git-pile, the pile branch
itself and the worktree directory it was using. If you have a backup of the
patches (either manual or if the pile branch is in a remote repository), this
is pretty safe to do and allow you to redo the configuration.