Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Add explicit `checkout` step (#1280)

John Yang25a76dc9328b
diff --git a/sweagent/environment/repo.py b/sweagent/environment/repo.py
index 27c8befc..3533b6dc 100644
--- a/sweagent/environment/repo.py
+++ b/sweagent/environment/repo.py
@@ -29,9 +29,11 @@ class Repo(Protocol):
def _get_git_reset_commands(base_commit: str) -> list[str]:
return [
+ "git fetch",
"git status",
"git restore .",
- f"git reset --hard {base_commit}",
+ "git reset --hard",
+ f"git checkout {base_commit}",
"git clean -fdq",
]