HIGH SEVERITYCONFIRMED

git checkout -B force-resets existing branch on agent retry

Package
open-swe
Version
latest
Verified
2026-03-28

Description

open-swe uses `git checkout -B` (confirmed at `github.py:72`) to create working branches. The `-B` flag force-resets the branch to the current HEAD if the branch already exists. On agent retry, all previous work on that branch is destroyed.

Reproduction

# github.py:72: git checkout -B <branch>
# If branch exists from a previous attempt:
# -B force-resets it to current HEAD
# Previous commits on branch lost
← All bugsScan your code →