I would like to modify the current git commit and remove its previous form. In other words the "old" current commit has to disapper and it is replaced by the "new" one with the same commit message.
At the moment I am doing:
git add .
git commit --amend --no-edit
git push --force
From the web interface (gitlab) or using git log
, I can see only the "new" current commit; but if I search for the "old" current commit hash (web interface or in .git
) I am still able to see the "old" commit content.
Is there a way to completely remove the old "current" commit?
Thanks
Update
Following some advice I have tried:
git add .
git commit --amend --no-edit
git stash clear
git fsck --unreachable --no-reflogs
git reflog expire --expire-unreachable=now --all
git gc --prune=now
git repack
git push --force
while locally I can see that the commits are not present anymore (git branch -a --contains <commit_id>
), the size of the repository on gitlab continue to increase, even if I triggered housekeeping.