Today I will walk through how you can take out a single file from a git repository and create its own repository with all the file commit history preserved.
When I started working at my workplace I initialized Maya script directory to git. At that time one repo was looking enough for entire folder. But when I started working with a tool, I realized an entire repo would be good for that tool. But it was too late to create another repo because I had already made 12-15 commits on that tool and I don’t wanted to lose the changes I made.
I researched it on internet and found this.
This is an excerpt from a StackOverflow question.
Basically what it is doing it is, creating patch based on the file history, along with the commiter and other data. And after creating another repository applying the patch. There is even no need to copy the files. The code is pretty self explanatary.
If you liked this post, please subscribe to my newsletter below.