0

First, my question is different from Create a submodule repository from a folder and keep its git commit history .

Suppose I have git folder, let's say ~/GITA.
I want to move a folder ~/Folder1 into it. (~/GITA/Folder1).
Then in the folder (~/GITA/Folder1), change it into submodule.
And then push it (submodule ~/GITA/Folder1) to the new created server repository.

Community
  • 1
  • 1
yuxuan
  • 417
  • 5
  • 16

1 Answers1

1

You have to do it in a different way:

  1. Create a new repository and add the code from Folder1 to it.
  2. Now add this repository as submodule under the GITA project.

Now you should have 2 project in which the Folder1 is a submodule of the the GITAproject.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • That's a good thought, `localA->remote->localB`. So there are no direct way, such as `git submodule init;git submodule remote add`? – yuxuan Apr 25 '16 at 22:08
  • upi have to add init & update the submodule. 3 commands and that's it. – CodeWizard Apr 25 '16 at 22:13
  • Excuse me, what's the meaning of "upi"? And you say 3 commands is about the former way (`localA->remote->localB`) or about the latter possible way (`git submodule init;git submodule remote add`). Thank you very much – yuxuan Apr 25 '16 at 22:17
  • Typo - should be you. sorry – CodeWizard Apr 25 '16 at 22:22