Reputation: 131
I am trying to reduce the size of .pack file in git repository. I have removed few uncessary objects in .pack file and pushed back to my developer branch. When I check my activity in gitlab:
But My merge request shows as follows:
Can someone explain me why merge request shows 49781 additions instead of deletions.
Upvotes: 0
Views: 106
Reputation: 2696
You can't merge rewriting of histories. You have to force push to master.
Master still has all the objects, merging would just add the rewritten commits to it, but not remove anything from its history.
But that still leaves other branches and tags that refer to the old objects and will prevent them from being deleted. You also want to update your tags anyway.
You should redo the filter on all branches and tags by appending --tag-name-filter cat -- --all
to the filter command. Refer to the git-filter-branch documentation on how to properly shrink the repository.
git filter-branch <...> --tag-name-filter cat -- --all
rm .git/refs/remotes/origin/HEAD
git push -f origin 'refs/remotes/origin/*:refs/heads/*'
git push -f --tags
git fetch
You need to use the same filter (or one that deletes at least as much or more) so your develop branch won't be completely different from the other branches, or reset develop to the state before you filtered it.
Upvotes: 1