Skip to content

fix: skip rebase in git/fetch when upstream branch no longer exists#682

Merged
credfeto merged 1 commit into
mainfrom
fix/681-fetch-rebase-invalid-upstream
Jun 15, 2026
Merged

fix: skip rebase in git/fetch when upstream branch no longer exists#682
credfeto merged 1 commit into
mainfrom
fix/681-fetch-rebase-invalid-upstream

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Guard both git rebase calls in git/fetch with git rev-parse --verify '@{upstream}' before executing
  • When the upstream branch no longer exists (pruned by git fetch --prune), emit an info message and skip the rebase instead of failing fatally
  • Applies to both the main rebase path and the post---switch-to-main rebase path

Closes #681

After git fetch --prune removes a stale remote tracking ref, an
unconditional git rebase fails with "fatal: invalid upstream" when the
current branch was tracking that deleted branch. Guard both rebase calls
with git rev-parse --verify '@{upstream}' so they are skipped (with an
info message) rather than causing a fatal error.

Closes #681

Prompt: hey, fetch needs fixing... → No pending changes in working folder. Rebasing...
fatal: invalid upstream 'refs/remotes/origin/feature/issue-408-optimise-project-checks'

✗ Could not rebase /home/markr/work/funfair/funfair-build-check
@github-actions github-actions Bot added the auto-pr Pull request created automatically label Jun 15, 2026
@credfeto credfeto added the AI-Work Work for an AI Agent label Jun 15, 2026
@credfeto credfeto merged commit e7364f7 into main Jun 15, 2026
16 checks passed
@credfeto credfeto deleted the fix/681-fetch-rebase-invalid-upstream branch June 15, 2026 08:40
@credfeto

Copy link
Copy Markdown
Owner

Super-linter summary

Language Validation result

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Work Work for an AI Agent auto-pr Pull request created automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: git/fetch fails when current branch's upstream has been pruned

1 participant