pcottle/learnGitBranching · warning · CommandResult
git-result-nothing
Error message
git-result-nothing
What it means
After the interactive rebase dialog resolves, if the user dropped every commit (submitted an empty selection), there is nothing left to replay and a CommandResult 'nothing' is thrown. Analogous to aborting with an empty todo list.
Source
Thrown at src/js/git/index.js:2441
});
}
var promise = new Promise(function(resolve, reject) {
var InteractiveRebaseView = require('../views/rebaseView').InteractiveRebaseView;
// interactive rebase view will reject or resolve our promise
new InteractiveRebaseView({
deferred: { resolve: resolve, reject: reject },
toRebase: toRebase,
initialCommitOrdering: initialCommitOrdering,
aboveAll: options.aboveAll
});
}.bind(this));
promise
.then(function(userSpecifiedRebase) {
// first, they might have dropped everything (annoying)
if (!userSpecifiedRebase.length) {
throw new CommandResult({
msg: intl.str('git-result-nothing')
});
}
// finish the rebase crap and animate!
this.rebaseFinish(userSpecifiedRebase, {}, targetSource, currentLocation);
}.bind(this))
.catch(function(err) {
this.filterError(err);
this.command.set('error', err);
this.animationQueue.start();
}.bind(this));
};
GitEngine.prototype.filterRebaseCommits = function(
toRebaseRough,
stopSet,
optionsView on GitHub (pinned to 5b09d0ff96)
Solutions
- Keep at least one commit, or use git reset / branch -d if the goal is to discard the branch entirely
- Use squash on the last commit rather than dropping everything
- Catch the CommandResult if an empty rebase is an expected user action
Example fix
// before // rebase -i dialog with all commits dropped // after git reset --hard main
Defensive patterns
Strategy: fallback
Validate before calling
if (!userSpecifiedRebase.length) { /* user dropped everything; reset instead of rebase */ } Try / catch
try { interactiveRebase(); } catch (e) { if (e instanceof CommandResult) return; throw e; } Prevention
- Keep at least one commit in the todo list
- Use reset to discard a whole branch
When it happens
Trigger: Running git rebase -i and deleting/deselecting all commits in the resulting dialog, so userSpecifiedRebase.length === 0.
Common situations: Users trying to 'squash away' an entire branch by dropping all lines; accidentally submitting an empty todo list in the UI.
Related errors
- Hey those commits don't exist in the set!
- git-error-rebase-none
- git-error-exist
- cannot fetch to ' + ref + ' when checked out on ' + ref
- ' + ref + ' is not a branch
AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27).
Data as JSON: /api/errors/7f745af4f975b536.
Report an issue: GitHub.