1

I may have the wrong approach here, but this is what I want to do and I'm not sure how to do it:

I have a source tree (a magento shop) which is one big git repo. magento is expandable with extensions, and I did install one. an extension is basically another source tree, which is copied into the main source tree and so gets added to the main repo.

now I want to add a new version of the extension. I could just copy over the new source tree, which would overwrite my own changes. what I would like to do instead is merging the updated source tree into the main repo.

my impression is, that I could add the extension source tree as a git-submodule. how would I do this and what happens with the existing files, which are tracked in the main repo now, but should be tracked in the git-submodule (as I understand it).

perler
  • 183
  • 2
  • 12

1 Answers1

0

A submodule is a gitlink, a special entry in the git index.
That entry won't be created if the folder for that submodule was already versioned.

You need first to remove the folder (save your changes if you made any in that subfolder):

  • if it was versioned: git rm -r subfolder
  • if it was not: rm -Rf subfolder

Then add that extension as a submodule:

git submodule add /url/to/extension/repo subfolder
git submodule update --init
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ok, but what i want to merge is not just a folder but a bunch of files all over the repo. more along these lines: http://stackoverflow.com/questions/23569821/is-there-a-way-to-add-a-submodule-to-a-git-repo-that-share-a-directory-structure – perler Jul 26 '14 at 09:01
  • @perler I don't think it is possible: a submodule is by its very nature limited to a subfolder of a parent repo. – VonC Jul 26 '14 at 09:07