Skip to content

Commit 70a7dd0

Browse files
authored
Release v0.19.1 (#915)
Backport #914 to 0.19
1 parent 69aa4ee commit 70a7dd0

File tree

5 files changed

+129
-0
lines changed

5 files changed

+129
-0
lines changed

.changes/v0.19.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## <a name="v0.19.1">v0.19.1</a> - 2025-10-25
2+
### Fixed
3+
- branch delete: Fix prompt for unmerged branch deletion not respecting the "no" answer.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
66
and is generated by [Changie](https://github.com/miniscruff/changie).
77

8+
## <a name="v0.19.1">v0.19.1</a> - 2025-10-25
9+
### Fixed
10+
- branch delete: Fix prompt for unmerged branch deletion not respecting the "no" answer.
11+
812
## <a name="v0.19.0">v0.19.0</a> - 2025-10-19
913
### Added
1014
- Add experimental 'gs commit pick' to cherry-pick a commit and update upstack branches in one go. Opt into it with `git config --global spice.experiment.commitPick true`. The command presents an interactive prompt when invoked without any arguments. ![demo of gs commit pick](https://media.githubusercontent.com/media/abhinav/git-spice/refs/heads/main/doc/tapes/20251018-commit-pick.gif)

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,83 @@ To release a new version, take the following steps:
189189
Feel free to edit it before merging if needed.
190190
3. Once the pull request has merged, trigger the
191191
[Publishh release workflow](https://github.com/abhinav/git-spice/actions/workflows/publish-release.yml).
192+
193+
## Backporting changes
194+
195+
(For maintainers only.)
196+
197+
To backport a change to a previous release branch,
198+
take the following steps:
199+
200+
1. Determine the series name.
201+
This is the combination of the major and minor version numbers,
202+
e.g. for version `v0.5.2`, the series name is `0.5`.
203+
204+
```bash
205+
SERIES=0.5
206+
```
207+
208+
2. Ensure that a release series branch exists.
209+
This is normally named `release/vX.Y.x`,
210+
where `X.Y` is the series name determined above.
211+
212+
```bash
213+
BRANCH="release/v${SERIES}.x"
214+
if git branch -r --list "origin/${BRANCH}" | grep -q .; then
215+
echo "Release branch ${BRANCH} alrady exists."
216+
else
217+
echo "Release branch ${BRANCH} does not exist."
218+
LATEST_TAG=$(git tag --list "v${SERIES}.*" --sort=-v:refname | head -n 1)
219+
echo "Creating branch ${BRANCH} from latest tag ${LATEST_TAG}."
220+
echo "Press Enter to continue."
221+
read
222+
git branch "${BRANCH}" "${LATEST_TAG}"
223+
git push origin "${BRANCH}"
224+
fi
225+
```
226+
227+
3. Create a backport branch from the release branch.
228+
229+
```bash
230+
BACKPORT_BRANCH="backport-${SERIES}-$(date +%Y%m%d%H%M%S)"
231+
git checkout -b "${BACKPORT_BRANCH}" "origin/${BRANCH}"
232+
```
233+
234+
4. Cherry-pick the desired commits to backport.
235+
236+
```bash
237+
git cherry-pick <commit-hash-1> <commit-hash-2> ...
238+
```
239+
240+
5. Prepare the changelog for the backport.
241+
242+
```bash
243+
changie batch patch && changie merge
244+
git add .changes CHANGELOG.md
245+
NEW_VERSION=$(changie latest)
246+
git commit -m "Release ${NEW_VERSION}"
247+
```
248+
249+
5. Submit a pull request from the backport branch
250+
against the release branch, e.g.
251+
252+
```bash
253+
git push -u origin "${BACKPORT_BRANCH}"
254+
gh pr create \
255+
--base "${BRANCH}" \
256+
--head "${BACKPORT_BRANCH}" \
257+
--title "Release ${NEW_VERSION}"
258+
```
259+
260+
6. Once the pull request is merged,
261+
trigger the
262+
[Publish release workflow](https://github.com/abhinav/git-spice/actions/workflows/publish-release.yml)
263+
for the release branch to create a new release.
264+
265+
7. Merge the release branch back to main.
266+
267+
```bash
268+
git checkout main
269+
git merge "origin/${BRANCH}"
270+
git push origin main
271+
```

internal/handler/delete/handler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ func (h *Handler) DeleteBranches(ctx context.Context, req *Request) error {
325325
if err := ui.Run(h.View, prompt); err != nil {
326326
return fmt.Errorf("run prompt: %w", err)
327327
}
328+
329+
// If the user declined the prompt, skip this branch.
330+
if !force {
331+
log.Infof("%v: skipped deletion", branch)
332+
continue
333+
}
328334
}
329335

330336
if exists {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# When declining the prompt to delete an unmerged branch,
2+
# the branch should not be deleted.
3+
#
4+
# https://github.com/abhinav/git-spice/issues/912
5+
6+
as 'Test <[email protected]>'
7+
at '2025-10-25T10:00:00Z'
8+
9+
mkdir repo
10+
cd repo
11+
git init
12+
git commit --allow-empty -m 'initial commit'
13+
gs repo init
14+
15+
git add foo.txt
16+
gs bc foo -m 'add foo.txt'
17+
18+
git checkout main
19+
20+
# Decline the prompt to delete the unmerged branch
21+
env ROBOT_INPUT=$WORK/robot.golden ROBOT_OUTPUT=$WORK/robot.actual
22+
gs branch delete foo
23+
cmp $WORK/robot.actual $WORK/robot.golden
24+
stderr 'foo: skipped deletion'
25+
26+
# Branch should still exist
27+
git rev-parse --verify foo
28+
stdout '1b2aafed11ebc65ef2643881bf22015cf352790f'
29+
30+
-- repo/foo.txt --
31+
whatever
32+
-- robot.golden --
33+
===
34+
> Delete foo anyway?: [y/N]
35+
> foo has not been merged into HEAD. This may result in data loss.
36+
false

0 commit comments

Comments
 (0)