I have one git repo{one-repo} , Now my aim is to get some folder and sub-folder of other repo{second-repo} into my one-repo at some specific path. and frequently I should be able to fetch all checkin done in second-repo to my one-repo. Any Suggestion how to achieve these kind of workflow.This fetching will be happening very frequently. We have been doing this thing in perforce till now but now we have moved to git.
like my one-repo:
repo1/code/f1/f2
repo1/code/f1/
repo1/code/f3
in second-repo:
repo2/code2/f4/
repo2/code2/f4/f5/f6
repo2/code2/f4/f7/
repo2/code2/f8
and my new one-repo would be:
repo1/code/f1/f2
repo1/code/f1/f5/f6
repo1/code/f1/f4/f7
repo1/code/f3/f8
It sounds you're looking for git subtrees or git submodules. Take a look that the two following articles, both of them explain strategies to accomplish what you need but there are trade-offs. The main one being that for subtrees you essentially have a more complex workflow in order to integrate changes back into the parent repo.
Git submodules are simpler to use, however, for someone coming from Perforce it might seem counter-intuitive that when using submodules the sources are not stored in the parent repo, only references to them.