When we split the source code for various openfire plugins out of the main Openfire git repo, which created individual repos for each plugin, we had a problem with lots of unrelated Openfire commit history coming along for the ride. See this forums post for example problem this caused. The main issue being a bloated repo (~500 MB) with 5,500 commits!
I am keen on attempting to fix this situation, which currently requires a force-push due to other complicated issues with how the present git history was constructed. To document the procedure I am doing and to solicit comments:
- Clone the Openfire repo
git clone https://github.com/Igniterealtime/Openfire.git
- Create a MYFILES.txt file containing file paths to save whilst running
$ cat MYFILES src/plugins/pluginname plguins/pluginname
git filter-repo -f --paths-from-file MYFILES
- back up one commit, to remove the commit that deleted the plugin
git reset --hard HEAD~1
- do a manual move of the
plugin/pluginnamecontent to the root folder of the repo, commit that change effectively bringing the repo tree inline with the present upstream repo.
- fetch the master branch of the plugin of interest
git remote add upstream https://github.com/igniterealtime/openfire-pluginname-plugin.git; git fetch upstream master
- By inspecting the
git log, find a series of commits from the current master branch to cherry-pick here, so
git cherry-pick --strategy=recursive -X theirs rev1^...revn, manual merging is then hopefully not necessary.
- Update the readme to denote this git history rewrite and link to this very post
- Force push to the igniterealtime repo!
What do folks think of this? Anybody with stronger git foo to suggest otherwise?
As a sample, you can see what I did to the openfire-loadStats-plugin repo (67 commits, 200 KB in size).