-1

I have a git repository that have few sub folders, and i want to clone this repository as a sub-directory to another repository (locally) and be able to fetch, pull and track.

example: from:

folder1
folder2
.git

into:

.git
folder
--folder1
--folder2
Ari M
  • 1,386
  • 3
  • 18
  • 33

2 Answers2

0

You are searching for git-submodule:

cd /path/to/other_project
git submodule add git@github.com/user/project.git folder
hek2mgl
  • 152,036
  • 28
  • 249
  • 266
  • Im not sure this is what I need. I just want the repository to be in a sub-folder, not with a different git management. – Ari M Aug 21 '14 at 09:01
0

You have several ways of doing such a thing:

  1. git submodule - git submodule is a git repository inside any other git repository. You can either clone the whole repository or only part of it (Last X commits, specific branch etc)

  2. git subtree - very similar to submodules but the main difference is where the data is stored.

  3. Not exactly what you are asking but im putting here since its good to know it.
    See the linked answer and manual for details.

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167