Skip to content

Fix EFS clone HEAD pointing to wrong branch after fetch+reset#2326

Merged
hiroshinishio merged 3 commits intomainfrom
wes
Feb 25, 2026
Merged

Fix EFS clone HEAD pointing to wrong branch after fetch+reset#2326
hiroshinishio merged 3 commits intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Collaborator

Summary

  • When .git already existed on EFS, git fetch --depth 1 origin <branch> + git reset --hard FETCH_HEAD updated the working tree to the correct branch content but left HEAD pointing to the original branch (e.g. master instead of release/20260408)
  • Added git checkout -B <branch> FETCH_HEAD after reset to update HEAD to the correct target branch
  • Found while testing the PHPUnit PR: SpiderPlus EFS had target_branch=release/20260408 in the DB but .git/HEAD showed refs/heads/master

When .git already existed on EFS, git fetch + reset --hard FETCH_HEAD updated
the working tree but left HEAD pointing to the original branch (e.g. master).
Added git checkout -B to update HEAD to the correct target branch.
@hiroshinishio hiroshinishio self-assigned this Feb 25, 2026
When .git already existed on EFS, git fetch + reset --hard FETCH_HEAD updated
the working tree but left HEAD pointing to the original branch (e.g. master
instead of release/20260408). Now reads .git/HEAD via read_local_file and runs
git checkout -B only when the branch actually changed, avoiding unnecessary
work when the branch is the same.
@hiroshinishio hiroshinishio merged commit 8af75ad into main Feb 25, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch February 25, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant