Reputation: 113335
I have a repository foo
that contains a file Alice.js
.
I want to take that file (that has lots of commits) and create a new repository only with the commits from that file.
How can I do this?
Example:
.
+- Alice.js
+- Bob.png
+- Another.file
do magic
.
+- Alice.js
The new repository contains only the commits from Alice.js
.
Upvotes: 2
Views: 40
Reputation: 9403
You might want to try sparse checkout
. The steps would be:
Create a empty repo with remote, as follows:
git init <repo>
git remote add -f origin <url>
Then, git config core.sparsecheckout true
. Add files to checkout to .git/info/sparse-checkout
.
And finally you can pull in the changes: git pull origin master
.
Upvotes: 1