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,
  options

View on GitHub (pinned to 5b09d0ff96)

Solutions

  1. Keep at least one commit, or use git reset / branch -d if the goal is to discard the branch entirely
  2. Use squash on the last commit rather than dropping everything
  3. 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

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


AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27). Data as JSON: /api/errors/7f745af4f975b536. Report an issue: GitHub.