pcottle/learnGitBranching · warning · CommandResult
git-result-uptodate
Error message
git-result-uptodate
What it means
merge() pre-flight: if mergeCheck reports the target source is already an ancestor of HEAD, the merge is a no-op fast-forward situation and 'already up to date' is thrown as a CommandResult. It mirrors git's 'Already up to date.' output.
Source
Thrown at src/js/git/index.js:2619
if (!options.dontResolvePromise) {
this.animationQueue.thenFinish(chain);
}
return chain;
};
GitEngine.prototype.mergeCheck = function(targetSource, currentLocation) {
var sameCommit = this.getCommitFromRef(targetSource) ===
this.getCommitFromRef(currentLocation);
return this.isUpstreamOf(targetSource, currentLocation) || sameCommit;
};
GitEngine.prototype.merge = function(targetSource, options) {
options = options || {};
var currentLocation = 'HEAD';
// first some conditions
if (this.mergeCheck(targetSource, currentLocation)) {
throw new CommandResult({
msg: intl.str('git-result-uptodate')
});
}
if (this.isUpstreamOf(currentLocation, targetSource) && !options.noFF && !options.squash) {
// just set the target of this current location to the source
this.setTargetLocation(currentLocation, this.getCommitFromRef(targetSource));
// get fresh animation to happen
this.command.setResult(intl.str('git-result-fastforward'));
return;
}
// now the part of making a merge commit
var parent1 = this.getCommitFromRef(currentLocation);
var parent2 = this.getCommitFromRef(targetSource);
// we need a fancy commit message
var msg = intl.str(View on GitHub (pinned to 5b09d0ff96)
Solutions
- Skip the merge — the branch is already incorporated
- Merge the other direction (merge the branch that has new commits into the current one)
- Catch the CommandResult and continue
Example fix
// before git merge main; git merge main; // second is no-op // after git checkout main git merge feature
Defensive patterns
Strategy: try-catch
Validate before calling
if (engine.mergeCheck(targetSource, 'HEAD')) { /* already up to date; skip */ } Try / catch
try { engine.merge(t); } catch (e) { if (e instanceof CommandResult && /up to date/i.test(e.msg)) return; throw e; } Prevention
- Check ancestry direction before merging
- Idempotent scripts should tolerate no-op merges
When it happens
Trigger: Calling merge where this.mergeCheck(targetSource, 'HEAD') is true — e.g. git merge main while HEAD already contains main's commits.
Common situations: Merging a branch twice; merging an ancestor; scripted solutions that merge regardless of state.
Related errors
- git-error-origin-fetch-uptodate
- 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/419bdeed054f7074.
Report an issue: GitHub.