I have new structure (new repository and its own branches) for new version of my project , and i need to clone some parts of last version to keep history of old commits for new programmers. let say my old repository include whole project with all plugins , and in this version we focus only on plugins and we do not want to clone whole project , but those plugins which we use must have git history to check old commit. how it possible ?
Asked
Active
Viewed 33 times
1 Answers
0
You can clone the whole repository and then remove the unwanted parts using git filter-branch
.
This is how you remove a single file from the repository history:
git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
where filename
is the path to the file you want to remove.
Or if the part you want to keep is in a single directory, you can do
git filter-branch --subdirectory-filter foodir -- --all
This rewrites the history as if foodir/
had been its project root and discards all other history.
Read documentation carefully to apply it for your specific case.

buff
- 2,063
- 10
- 16