3

I have open source project in Git repository. In the project, I'm using source code of another open source project. That code is stored in Git repository subfolder. I'd like to add the SVN repository [interested in trunk only] as a branch, but only for that specific Git subfolder.

Note that I have modified the code of the other project, so I'm not looking for simple 1:1 copy. I just want to have an option to merge changes from the SVN to my Git repository, when I decide to do so. I will NOT need to commit back to SVN.

I've found How to use git-svn to checkout only trunk and not branches and tags?

But I do not know how to link it to a subfolder only.

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

2 Answers2

1
  • Convert subfolder or wrapper git-repo into submodule or subtree
  • Link nested repo (I may be wrong in case of subtree technique) with SVN-repo using git-SVN
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Thanks for bringing my attention to submodules. Anyway, I was asking how to use SVN as a branch. But it does not look like submodule can solve this. – Martin Prikryl Apr 07 '14 at 07:31
  • @MartinPrikryl - my Git knowledge is rather weak, but isn't "remote tracking branch" a second part of answer? – Lazy Badger Apr 07 '14 at 17:33
  • Git knowledge is rather weak too. I believe you are right. But branch does not answer the subfolder part. Or at least I do not know how to combine these concepts. – Martin Prikryl Apr 08 '14 at 06:03
  • @LazyBadger is right. Git doesn't understand what a subdirectory is. It monitors the entire project, not files nor paths. For the task you want to do, the only way is to create a repo whose root contents are the ones in your svn trunk. This repo will have svn as a remote from which it can merge on a one-by-one basis. In turn, your main project holds the submodule as a guest, but doesn't care about its particular commits or revisions. It doesn't know anything bout your svn remote. That's left for submodule to sort out. – ffflabs Apr 08 '14 at 10:34
  • Thanks. I suppose my main repo can reference different revisions of the svn submodule on different branches (of the main repo), right? – Martin Prikryl Apr 08 '14 at 13:32
  • I've awarded the bounty, so that it does not expire. But to be honest, I'm still hoping for more in-depth answer. – Martin Prikryl Apr 08 '14 at 15:39
0

It looks like that you want to implement a vendor branch. For example, see this thread How do I import a third party lib into git?.

Community
  • 1
  • 1
bahrep
  • 29,961
  • 12
  • 103
  • 150
  • Thanks for you answer. I'd prefer to avoid manual import of 3rd party source code changes. Particularly because I want to see their commits, so I can cherry pick those I'm interested in. Can I use git-svn to create a branch? And I still do not know how to link it to a subfolder only. – Martin Prikryl Apr 03 '14 at 09:51