0

Using Windows for development, Debian for servers and repos, Git Extensions as Git client.

I have the following repos:

REPO1:

ROOT_OF_SITE1/

REPO2:

ROOT/
    /SITE1/
    /SITE2/
    /SITE3/

SITE2 and SITE1 share the same code base, just SITE1 is a few commits ahead, but since the path is different can not cherry pick commits from SITE1 from REPO1 to SITE1 in REPO2.

I suppose one of the solutions is to convert SITE2 subdirectory to Git submodule, so then I could cherry pick commits from SITE1.

However each time I use git submodules, I'm facing problems in Git Extensions.

Unfortunately the Git Extensions Git client does not support subtree at this time.

klor
  • 1,237
  • 4
  • 12
  • 37

1 Answers1

1

I would use one repo with SITE1 and I would split the rest of sites using git subtree. You can divide your repo in different branches, keeping several modules organized with a quite clean tree:

git subtree split --prefix=site2 -b site2

Check this post for further information. You can then build the tree back leaving a really nice git history.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Carlos Cavero
  • 3,011
  • 5
  • 21
  • 41
  • Unfortunately Git Extensions git client does not support subtree at this time. – klor Nov 18 '19 at 18:10
  • You can use [Git bash](https://gitforwindows.org/) or similar and the command line – Carlos Cavero Nov 18 '19 at 18:22
  • I did read the subtree article and I found it very useful: https://tsh.io/blog/git-subtree-or-how-i-stopped-worrying-and-learned-to-love-external-dependencies/ I will try subtree from command line. – klor Nov 19 '19 at 15:42
  • I did not try myself in-depth but people says is awesome and they recommend the use of git subtree instead of git submodule – Carlos Cavero Nov 19 '19 at 15:53