- First, we'll decide which folders and files to keep in the new repository; we'll delete everything from the repository except those files. We'll store the files and folders to be kept in a string separated by | so that we can feed it to grep as a regular expression, as shown in the following command:
keep="org.eclipse.jgit.http|LICENSE|.gitignore|README.md|.gitattributes"
- Now we are ready to start the conversion of the repository. We'll use the git filter-branch command, which can rewrite the entire history of the repository; just what we need for this task.
Always remember to make sure you have a backup of the repository you are about to run git filter-branch on, in case something goes wrong.
- We'll use the --index-filter ...