I have a local repository currently in development and I'd like to share (part of) it publicly on GitHub. What I've done so far:
git checkout dev # dev is the current development branch of my local repository git branch public # create a new branch from dev for the public repo git checkout public git remote add public [email protected] # add the public repo as a new remote git push -u public public:master # push local 'public' branch to 'master' branch of 'public' remote This push failed, however, because my repository contains some fairly large subdirectories. So I set about cleaning it:
git rm -r --cached external # remove large subdirectory 'external' git rm -r --cached ... # repeat for other large subdirectories I then included all the above subdirectories in the .gitignore as well and committed. A call to git ls now shows only a small number of files, the combined size of which is at most a few MB, and a call to git status shows no uncommitted or untracked files. However git push still fails, apparently because the large subdirectories are still included in the branch's history.
The correct way to purge files from history seems to be to use the git filter-branch command, however this command has a lot of warnings attached to it, and I don't want to mess up my entire repository in the process. How do I properly purge the subdirectories (and only the subdirectories) I removed above with git rm from the history of the public branch (and only the public branch)?
Since the branch is unlikely to ever be merged back into the other branches, I'd be OK with simply removing all history from it as well, as a last resort. The other branches should still remain exactly as they are, however