mirror of
https://github.com/abhinav/git-spice.git
synced 2026-11-30 04:42:23 +01:00
main
CI / Lint (push) Canceled after 0s
CI / Generate test matrix (push) Canceled after 0s
CI / Test / ${{ matrix.name }} (push) Canceled after 0s
CI / OK (push) Canceled after 0s
GitHub Pages / build (push) Canceled after 0s
GitHub Pages / deploy (push) Canceled after 0s
autofix.ci / autofix (push) Canceled after 0s
Extend `--fill` to generate commit and CR messages with a
user-configured command.
Support commit creation and amendment, branch creation and squash, and
submission of new CRs.
Configure the command with `spice.message.fill.command`.
Set `spice.message.fill=true` to enable filling by default, with
`--no-fill` to opt out.
Explicit messages and message files take precedence.
Submit and squash retain their built-in filling behavior when no command
is configured.
Like Git’s `prepare-commit-msg` and `commit-msg` hooks, the command
receives a message-file path and edits it in place.
Additional arguments identify the invoking operation and, for squash and
submission, the selected commit range:
command MESSAGE_FILE OPERATION
command MESSAGE_FILE OPERATION BASE_SHA HEAD_SHA
The command inherits stdin, stdout, and stderr, allowing terminal
editors and interactive scripts.
A nonzero exit status aborts the operation.
Commit operations invoke the command as Git’s message editor, deferring
index normalization to Git.
Scripts can use `git diff --cached` to inspect the changes being
committed.
For squash and submission, scripts inspect the supplied commit range
through Git.
For CRs, the first line becomes the title and the remainder becomes the
body.
---------
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
git-spice
Introduction
git-spice is a tool for stacking Git branches. It lets you manage and navigate stacks of branches, conveniently modify and rebase them, and create GitHub, Bitbucket, Gitea, or Forgejo Pull Requests or GitLab Merge Requests from them.
See https://abhinav.github.io/git-spice/ for more details.
Usage looks roughly like this:
# Stack a branch on top of the current branch.
$ gs branch create feat1
# Stack another branch on top of feat1.
$ gs branch create feat2
# Submit pull requests for feat1 and feat2.
$ gs stack submit
# Pull latest changes from the remote repository
# and delete merged branches.
$ gs repo sync
# Restack branches on top of the latest changes.
$ gs stack restack
Or equivalently, using CLI shorthands:
$ gs bc feat1 # branch create feat1
$ gs bc feat2 # branch create feat2
$ gs ss # stack submit
$ gs rs # repo sync
$ gs sr # stack restack
Features
- Create, edit, and navigate stacks of branches with ease.
- Submit the entire stack or parts of it with a single command. Supports GitHub, GitLab, Bitbucket, Gitea, and Forgejo hosts such as Codeberg.
- Keep using your existing workflow and adopt git-spice incrementally.
- Completely offline operation with no external dependencies until you push or pull from a remote repository.
- Easy-to-remember shorthands for most commands.
Documentation
See https://abhinav.github.io/git-spice/ for the full documentation.
Sponsors



License
This software is distributed under the GPL-3.0 License:
git-spice: Stacked Pull Requests
Copyright (C) 2024 Abhinav Gupta
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
See LICENSE for details.
Languages
Go
99.6%
Shell
0.4%
