/git-workflow:git-rebase-continue-editor-noninteractivefrom git-workflow
Fix for `git rebase --continue` failing in non-interactive shells with the misleading error `"there was a problem with the editor 'nano'"` / `"could not commit staged changes"`. Use when: (1) you ran `git rebase --continue` after manually resolving a merge conflict via `git add`, in a non-interactive context (CI workflow, agent dispatch, ctx_execute, headless script), and the rebase silently aborted instead of completing; (2) the error output suggests using `-m`/`-F` but `git rebase --continue` rejects those flags; (3) `git status` shows the conflict-resolved files staged but uncommitted, `git branch --show-current` is empty (detached HEAD), and the rebase metadata under `.git/rebase-merge/` (or `.git/worktrees/<wt>/rebase-merge/` for a worktree) is still present; (4) you're scripting bulk-rebases across multiple PR branches and one of them stalls on a manually-resolved conflict. Root cause is `git rebase --continue` unconditionally opening `$GIT_EDITOR` to confirm the commit message; there is no `--no-edit` flag for `git rebase`. Fix is one env-var prefix: `GIT_EDITOR=true git rebase --continue`.
Trending skills
7-day visitors to each skill page
Ships in git-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You're rebasing a branch in a non-interactive shell (CI runner, agent
dispatch, ctx_execute, scripted automation). A conflict fires.
You resolve it, git add the files, and run git rebase --continue.
Instead of completing the rebase, git prints:
error: there was a problem with the editor 'nano'
Please supply the message using either -m or -F option.
error: could not commit staged changes.
The error message is misleading:
-m / -F hint applies to git commit, not git rebase --continue — passing them to rebase is rejected.The branch is now in a half-finished rebase state: HEAD points to
the parent commit, the resolved files are staged but uncommitted,
and .git/rebase-merge/ (the rebase state directory) is still
present. Re-running git rebase --continue produces the same error.
Running git rebase --abort works but throws away the manual
conflict resolution.
Any of these:
there was a problem with the editor and
could not commit staged changes.git status after the failed continue shows the resolved files
staged (A file_A, M file_B) and no merge markers.git branch --show-current returns nothing (detached HEAD).ls .git/rebase-merge/ (or for a worktree:
ls .git/worktrees/<wt>/rebase-merge/) shows the rebase state
directory still exists.ctx_execute(language: "shell", ...),
subprocess.run(...) from Python, etc.git rebase --continue is implemented as: commit the resolved
conflict, then move to the next commit in the rebase plan. The commit
step opens the editor ($GIT_EDITOR → $EDITOR → fallback to
vi/nano) so you can edit the commit message before it lands. In an
interactive shell this is convenient; in a non-interactive shell, the
editor process can't acquire a TTY and exits non-zero. Git treats that
as "user aborted the commit" and bails.
There is no --no-edit flag for git rebase --continue (unlike
git merge --no-edit or git revert --no-edit). The
canonical workaround is to set $GIT_EDITOR to a no-op binary that
accepts the prefilled commit message without modification.
Prefix the command with GIT_EDITOR=true:
GIT_EDITOR=true git rebase --continue
true is the standard Unix command that exits 0 immediately. Git
invokes it as if it were an editor, the editor "completes
successfully" with no edits, and git uses the prefilled commit message
as-is.
Alternatives that also work:
EDITOR=true git rebase --continue # GIT_EDITOR overrides EDITOR
GIT_EDITOR=cat git rebase --continue # cat also exits 0 quickly
DO NOT use GIT_SEQUENCE_EDITOR=true — that's for the interactive
rebase TODO list (git rebase -i), not for the per-commit message
editor. Setting only GIT_SEQUENCE_EDITOR won't help here.
If you need to keep editing the commit message manually but the
prefilled message is fine, just GIT_EDITOR=true it.
# Reproduce
git rebase origin/main || true
# (resolve conflicts, git add the resolved files)
git rebase --continue
# Without fix: "problem with the editor 'nano'", staged changes
# uncommitted.
# Apply fix
GIT_EDITOR=true git rebase --continue
# With fix: the commit lands with the prefilled message; rebase
# proceeds to the next commit or completes.
# Confirm clean state
git status # should show "nothing to commit, working tree clean"
git branch --show-current # should print the branch name
ls .git/rebase-merge/ 2>&1 # No such file or directory (rebase done)
#!/bin/bash
set -euo pipefail # pipefail is critical — see Notes
for branch in feat/A feat/B feat/C; do
cd "<worktree-for-$branch>"
git fetch origin --quiet
if GIT_EDITOR=true git rebase origin/main; then
git push --force-with-lease
else
# Fall through to manual resolution path
echo "MANUAL: resolve conflicts in $branch then run:"
echo " GIT_EDITOR=true git rebase --continue"
echo " git push --force-with-lease"
fi
cd -
done
For an interactive manual resolution flow (a human resolves the conflict but the script continues programmatically), the pattern is:
# After human resolves and git-adds the conflict:
GIT_EDITOR=true git rebase --continue
git push --force-with-lease
Pair with set -o pipefail: if your script pipes git output
through tail, head, or grep, the pipe's exit code is the LAST
command's by default — so git rebase ... | tail -10 returns 0
even when the rebase failed. Without set -o pipefail, your
conflict-detection branch silently fails and the script continues
past a broken rebase. Always:
set -euo pipefail
This is the same root cause that makes git commit (no -m) fail
in non-interactive shells. The fix is the same:
GIT_EDITOR=true git commit (using the prepared message, e.g.
via git commit --reuse-message=HEAD@{1}).
git pull --rebase hits this if it has to pause for a conflict
and you continue without an interactive shell. Same fix.
git cherry-pick --continue after manual conflict resolution has
the SAME trap — the --no-edit flag exists for cherry-pick but
only suppresses the message editor on the FIRST commit; on
--continue, you still need GIT_EDITOR=true. (Or equivalently:
pass -x --no-edit upfront and ensure no conflicts.)
The skill cron-block-generation-gotchas covers the same family
of "tool runs fine interactively, breaks silently from cron" issues
for cron-installed scripts. If you're scripting git from cron,
always test under env -i first.
git rebase docs:
https://git-scm.com/docs/git-rebasegit commit editor selection
($GIT_EDITOR → core.editor → $EDITOR → $VISUAL → vi):
https://git-scm.com/docs/git-commit#_editorgit config core.editor:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreeditorcajias/nautilus-competition (2026-05-09).
Four branches rebased clean; one (feat/makefile) had a README.md
conflict between newly-merged ## Parallel runs and the branch's
### Make targets. Manual resolution via Edit + git add succeeded;
git rebase --continue from ctx_execute shell failed with the
editor error; GIT_EDITOR=true git rebase --continue succeeded
immediately and gh pr view 7 flipped from CONFLICTING/DIRTY to
MERGEABLE/CLEAN.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
6 skills in this plugin
/gh-pr-create-must-push-errorFix for "aborted: you must first push the current branch to a remote, or
use the --head flag" from `gh pr create` when the branch IS already
pushed. Use when: (1) `git push -u origin <branch>` succeeded moments
earlier, (2) `git branch -vv` shows upstream tracking is set, (3) `gh pr
create` still rejects with the must-push message. Workaround: pass
`--head <branch>` explicitly.
/gh-pr-merge-in-worktreesRecover from `gh pr merge --delete-branch` appearing to fail inside a git
worktree. Use when: (1) `gh pr merge 2 --delete-branch` prints
`failed to run git: fatal: '<branch>' is already used by worktree at
'<path>'`, (2) you suspect the PR merged anyway despite the error,
(3) you see a merged PR with its remote branch still present on origin,
(4) working in any multi-worktree setup where `main` is checked out in
a sibling worktree. Explains that `gh pr merge --delete-branch` runs
three separable steps (API merge, local delete, remote delete) and the
middle step failing leaves the merge state inconsistent with the
branch-cleanup state.
/git-deadlock-plumbing-recoveryDiagnose and recover git operations that HANG / DEADLOCK at ~0% CPU on macOS
(APFS) — git commit, git reset, git gc/repack, git push, and even git status
never returning. Use when: (1) a git write op "takes forever" / never finishes;
(2) `ps` shows the git process in interruptible sleep (STAT S/SN) with CPU TIME
frozen across samples; (3) a stale 0-byte `.git/index.lock` is present;
(4) `git push` stalls in "Counting objects" / `git repack -ad` hangs with an
empty pack dir; (5) `git count-objects -v` shows thousands of loose objects and
`packs: 0`; (6) the volume is near-full (`df` ~95%+); (7) `.git/index` went
missing after an interrupted git op. Covers the plumbing-commit workaround
(write-tree → commit-tree → update-ref) that bypasses the hanging working-tree
refresh and hooks, index recovery via read-tree, and the real fixes.
/git-squash-merge-tree-hash-diagnosisDiagnose and clean up a local branch that appears "N commits ahead of main"
after its PR was squash-merged on GitHub, but whose work is actually fully
integrated. Use when: (1) `git log main..HEAD` shows multiple commits but the
matching PR is closed/merged on GitHub; (2) `git pull --ff-only` on `main`
refuses with "Not possible to fast-forward" because local `main` accumulated
orphan commits that were absorbed by the squash; (3) `git rebase main`
would replay all branch commits and conflict because the squash commit's
patch is the SUM of the branch's commits, not equivalent to any individual
one; (4) `git log --cherry-mark --left-right main...HEAD` shows every branch
commit as `>` (unique to HEAD) even though the work is in main; (5) you
need to decide between "rebase + new PR" vs "delete merged branch" and the
commit graph is misleading. The canonical signal is tree-hash equality:
`git rev-parse HEAD^{tree}` vs `git rev-parse origin/main^{tree}` — if
equal, every file is byte-identical and the branch is fully merged
regardless of what the commit graph says. Covers the diagnostic, the safe
cleanup (`git reset --hard origin/main` to drop orphan local-main commits
whose content is in the squash), and why naïve `git rebase` is the wrong
tool here.
/parallel-subagent-git-worktree-raceFix/avoid HEAD+index corruption when running parallel Claude Code subagents
(Agent tool) that each mutate git (checkout/rebase/reset) in what you THOUGHT
were isolated worktrees. Use when: (1) you spawned 2+ agents with
isolation:"worktree" to rebase/merge/commit different branches concurrently;
(2) an agent reports "I am NOT in an isolated worktree" — `git rev-parse
--git-dir` and `--git-common-dir` both point at the same `.git`, `git worktree
list` shows a SINGLE worktree, and `--show-toplevel` is the main checkout;
(3) a rebase suddenly appears to be running on the WRONG branch, or the reflog
shows a branch reset/checkout you didn't issue during your run; (4) two agents'
`git checkout` calls swap HEAD/index underneath each other. Covers detection,
the serialize-to-one-owner recovery, and a ref-recheck guard pattern.
npx claudepluginhub cajias/claude-skills --plugin git-workflow