From 444487219984b510bfe8c95c25fd8d28466551d5 Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Wed, 2 Jun 2021 08:29:02 +0200 Subject: [PATCH] Do manual squash cleanup for docs (#6646) This PR abandons the attempt to do the cleanup in a single rebase command, and instead squashes the old commits manually. The current solution does not handle conflicts properly. The new approach (which seems to be more robust) proceeds as follows (to squash $first..$last): - checkout $last - soft reset to $first (checkout $first, but keep changes in working copy) - commit to squashed commit - cherry-pick $last..HEAD from main branch --- .github/workflows/docs_cleanup.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs_cleanup.yml b/.github/workflows/docs_cleanup.yml index f56a0f595..761736e75 100644 --- a/.github/workflows/docs_cleanup.yml +++ b/.github/workflows/docs_cleanup.yml @@ -36,6 +36,7 @@ jobs: touch -d "$mod" $file done find ./ -maxdepth 1 -name "docs-*" -mtime +7 -exec git rm -r {} + + find ./ -maxdepth 1 -name "docs-*" -xtype l -exec git rm {} + git commit -m "Prune docs" || echo "Nothing to prune" - name: Squash old commits @@ -47,7 +48,10 @@ jobs: first=`git rev-list --max-parents=0 HEAD` last=`git rev-list --until=1.month.ago -n1 HEAD` if [ -n "$last" ]; then - git rebase -Xtheirs --onto $first $last + git checkout $last + git reset --soft $first + git commit -m "Squash old history" + git cherry-pick $last..main git log fi @@ -66,4 +70,4 @@ jobs: git commit -m "Update README.md" fi - git push -f + git push -f origin HEAD:main -- 2.30.2