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
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
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
git commit -m "Update README.md"
fi
- git push -f
+ git push -f origin HEAD:main