Fix: Use git commit --amend when FORCE_PUSH=true to prevent commit accumulation #555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fix the gh-pages deployment script to actually prevent commit accumulation when
FORCE_PUSH=true.Problem
The
update-gh-pages-documentation.shscript hasFORCE_PUSH=trueas the default to "save git repo size (avoids accumulating large binary files)". However, it was creating a new commit each time and then force pushing, which defeats the purpose. This still accumulates commits with large binary files in the gh-pages branch history.Solution
When
FORCE_PUSH=true, usegit commit --amendinstead of creating new commits. This ensures the gh-pages branch maintains only one commit, truly preventing accumulation of large binary files.Changes
git commit --amendwhenFORCE_PUSH=trueto modify the existing commitFORCE_PUSH=false(creates new commits)Result
FORCE_PUSH=true: gh-pages branch will have only 1 commit, repo size stays minimalFORCE_PUSH=false: gh-pages branch preserves full historyRelated
This fixes the behavior introduced in the documentation build refactoring.