Reputation: 380
I have two repositories. One repository needs some files from another. I manage to use the second repository as a submodule in the first.
My question is: It is possible to make a submodule just with some files? Example: A and B are the repositories. B contains files 1,2 and 3. I need to make a submodule just with file 2 from B in A.
Upvotes: 0
Views: 361
Reputation: 112
1.Clone repository A to your local. git clone https://github.com/xx/repository B
2.Add repository B as a remote repository in A. git remote add RB https://github.com/xx/repository B
3.git fetch RB
4.git checkout master
5.git merge RB/master --allow-unrelated-histories
6.It will merge all the files 1, 2 ,3 to your local master branch in repository A
7.Remove the files 1 and 2. git rm 1 -f
Upvotes: 2