Stacked Git, StGit for short, is an application for managing Git commits as a stack of patches.
With a patch stack workflow, multiple patches can be developed concurrently and efficiently, with each patch focused on a single concern, resulting in both a clean Git commit history and improved productivity.
stg command line tool provides commands to quickly and
safely manage a stack of patches.
- Apply and unapplied patches from the stack using
- Incorporate changes from the working tree into a patch and edit patch
- Create and delete patches on the stack using
- See information about the stack or individual patches using
- Migrate patches to regular commits and vice versa using
Patch-stack management operations are performed using Git commands and the patches are stored as Git commit objects, allowing easy merging of the StGit patches into other repositories using standard Git functionality.
StGit is licensed under the GNU General Public License, version 2.
Why Stacked Git?
The stack of patches model is a natural way to maintain a clean Git history while working on several changes concurrently. A stack-oriented workflow using StGit can compliment, or even replace, many Git workflows involving rebase, branches, ammended commits, and stashes.
StGit, via the
stg command line tool, provides commands to quickly and
safely create, push, pop, refresh, and reorder patches.
StGit is written in pure Python with no third-party Python dependencies. StGit currently supports Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, and 3.8, although support for Python 2 will be dropped in a future release.
StGit interoperates closely with Git and does most of its work by
git commands. Git 2.2.0 or newer is required.
More details about StGit packages availability for various operating systems can be found on repology.
git clone https://github.com/stacked-git/stgit.git
To install from source, choose a
make prefix=/usr/local install install-doc
For more information about installation, see the INSTALL file.
For a more complete guide to using StGit, see the tutorial.
StGit also comes with a complete set of man pages which are also available online.
StGit source code is hosted on GitHub.
StGit is maintained by Pete Grayson and Catalin Marinas.
Issues and feature requests may be reported on the StGit issue tracker.
Pull requests are welcome and may be submitted to the repo on GitHub.
See CONTRIBUTING.md for more details about how to contribute to StGit.
Other Patch Stack Tools
StGit is not the first or only patch stack tool. Both Quilt and Mercurial's mq extension offer similar interfaces for managing a stack (or "queue" or "series") of patches. While Quilt operates on patches outside the context of any other version control system using GNU diff, the mq extension is part of the Mercurial version control system.
Similar to mq's relationship to Mercurial, StGit is tightly coupled to Git. StGit keeps its stack metadata as objects in the git repo and patches themselves are git commits.
Many thanks to Peter Grayson, Karl Wiberg, Yann Dirson, Chuck Lever and Paolo “Blaisorblade” Giarrusso for their great contribution to the development of StGit. Many thanks to all the people who contributed patches, ideas or reported bugs.