Repository clean-up

Is there a way to clean a repository without corrupting the Gitlab indexing/references? e.g. there’s a nice doc to perform some repository cleaning on the wiki:

https://docs.gitlab.com/ce/user/project/repository/reducing_the_repo_size_using_git.html

However, if the history is re-written (via the command line or …) how can we update the Gitlab instance so that e.g. references to branches/active merge requests/crosslinks in comments and … are also updated?

Thanks,

Andy