0

There was a project I did with some colleagues, which consisted of multiple sub-projects. All these sub-projects except one will have to be totally erased because of their content. This last project we'd like to make public. It happens to be the case that this sub-project had its own folder. What I want to do is erase all commits except those that affected this folder from our commit history, and make the repository public. I could just make a new repository but I'd like to keep all the commits to this project intact so we can work with it like we can with normal projects.

Is there a simple way to either keep only those commits that affected a certain folder, or another easy way to select only a few commits to keep instead of having to go over all of them one by one and either erase them or not?

Lara
  • 2,594
  • 4
  • 24
  • 36
  • http://stackoverflow.com/questions/307828/completely-remove-file-from-all-git-repository-commit-history might help – tkausl Jun 28 '16 at 21:16

1 Answers1

2

One can make some folder into the new root by:

git filter-branch --subdirectory-filter folder HEAD

Lara
  • 2,594
  • 4
  • 24
  • 36