Skip to content

fix: improve submodule sync in gh-pages worktree - #39

Merged
caothu159 merged 1 commit into
mainfrom
fix/submodule-sync-v2
May 30, 2026
Merged

fix: improve submodule sync in gh-pages worktree#39
caothu159 merged 1 commit into
mainfrom
fix/submodule-sync-v2

Conversation

@caothu159

Copy link
Copy Markdown
Contributor

Vấn đề

PR #38 đã thêm git submodule sync nhưng submodules vẫn không được phát hiện.

Root cause

git add -A không tự động add submodules mới vào index. Sau khi git rm xóa submodules khỏi index, cần git add src/ rõ ràng để đăng ký lại chúng.

Fix

  • Thêm git add src/ rõ ràng sau khi init và checkout submodule refs
  • Đơn giản hóa luồng sync: cd vào worktree một lần cho tất cả submodule operations
  • Dùng git submodule update --init --checkout thay vì --force

Luồng đúng sau fix

worktree create → git rm → copy .gitmodules → submodule sync → submodule update --init\n  → checkout refs → git add src/ (explicit) → git add -A → commit → push\n```

The previous fix added git submodule sync but submodules still weren't
detected by git add -A. Root cause: after git rm removes submodules
from the index, git add -A does not re-add them as new submodule entries.

Fix: explicitly 'git add src/' after initializing and checking out
submodule refs, forcing git to register them in the index.

Also simplify the sync flow:
- cd into worktree once for submodule operations
- use git submodule update --init --checkout for clean initialization
- add explicit 'git add src/' to register submodule entries in index
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@caothu159
caothu159 merged commit 3d11dbf into main May 30, 2026
3 checks passed
@caothu159
caothu159 deleted the fix/submodule-sync-v2 branch May 30, 2026 07:11
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