From 930f934e31651dcc173184cfa36f14b8102dcc6e Mon Sep 17 00:00:00 2001 From: claude Date: Wed, 24 Jun 2026 09:32:18 +0000 Subject: [PATCH] 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 --- services/web/app/src/Features/GitSync/GitSyncHandler.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/GitSync/GitSyncHandler.mjs b/services/web/app/src/Features/GitSync/GitSyncHandler.mjs index faa9d1b2e1..bc20a55edd 100644 --- a/services/web/app/src/Features/GitSync/GitSyncHandler.mjs +++ b/services/web/app/src/Features/GitSync/GitSyncHandler.mjs @@ -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 }