fix(git-sync): use reset --mixed so commit parent is FETCH_HEAD
git read-tree only updated the index, leaving HEAD on our previous local commit. The push commit's diff then included all remote changes outside subPath as if we made them. reset --mixed also moves HEAD to FETCH_HEAD, so the new commit's parent is the remote HEAD and the diff shows only the managed area changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
34d96c257f
commit
930f934e31
@@ -173,7 +173,9 @@ async function pushToRemote(
|
||||
// read-tree updates the index without checking out any files, so no blobs are downloaded.
|
||||
try {
|
||||
await spawnGit(['fetch', '--filter=blob:none', 'origin', branch], repoDir)
|
||||
await spawnGit(['read-tree', 'FETCH_HEAD'], repoDir)
|
||||
// --mixed: moves HEAD to FETCH_HEAD + updates index, no working tree change.
|
||||
// This makes FETCH_HEAD the parent of our next commit so the diff only shows subPath changes.
|
||||
await spawnGit(['reset', '--mixed', 'FETCH_HEAD'], repoDir)
|
||||
} catch {
|
||||
// Empty remote or first push — proceed with empty index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user