pcottle/learnGitBranching · error · GitError
' + branchName + ' is not a branch!
Error message
' + branchName + ' is not a branch!
What it means
assertBranchIsRemoteTracking first unescapes the branch name and throws this GitError when engine.resolveID returns null — the branch does not exist at all in the engine.
Source
Thrown at src/js/git/commands.js:103
};
var assertOriginSpecified = function(generalArgs) {
if (!generalArgs.length) {
return;
}
if (generalArgs[0] !== 'origin') {
throw new GitError({
msg: intl.todo(
generalArgs[0] + ' is not a remote in your repository! try adding origin to that argument'
)
});
}
};
var assertBranchIsRemoteTracking = function(engine, branchName) {
branchName = crappyUnescape(branchName);
if (!engine.resolveID(branchName)) {
throw new GitError({
msg: intl.todo(branchName + ' is not a branch!')
});
}
var branch = engine.resolveID(branchName);
if (branch.get('type') !== 'branch') {
throw new GitError({
msg: intl.todo(branchName + ' is not a branch!')
});
}
var tracking = branch.getRemoteTrackingBranchID();
if (!tracking) {
throw new GitError({
msg: intl.todo(
branchName + ' is not a remote tracking branch! I don\'t know where to push'
)
});
}View on GitHub (pinned to 5b09d0ff96)
Solutions
- Create or fetch the branch first (git branch / git fetch)
- Double-check spelling against git branch output
Example fix
// before git push origin feautre // after git push origin feature
Defensive patterns
Strategy: validation
Validate before calling
var name = crappyUnescape(branchName); if (!engine.resolveID(name)) { /* create/fetch or reject */ } Type guard
function branchExists(engine, name) { return !!engine.resolveID(crappyUnescape(name)); } Prevention
- Autocomplete branch names instead of free-text input
- git fetch before pushing to new branches
When it happens
Trigger: Calling a push/fetch config that runs assertBranchIsRemoteTracking with a typo'd or nonexistent branch name, e.g. git push origin maain.
Common situations: Typos; branch was never created; branch exists only on origin and was never fetched.
Related errors
- ' + ref + ' is not a branch
- ' + ref + ' is not a remote branch
- ' + branchName + ' is not a remote tracking branch! I don't
- fatal: HEAD does not point to a branch
- --delete doesn't make sense without any refs
AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27).
Data as JSON: /api/errors/3848f5f2c4b19d66.
Report an issue: GitHub.