1

There is a problem I'm having. We have a github setup for a group project. One of the folders in the git repo is a web app with its own heroku deployment, and therefore its own .git. Github always marks this file green, and I have no idea how to convert it from a git submodule to just an ordinary folder.

I tried adding the /path/.git to .gitignore but it didn't help.

Thanks for your help!

Xiv
  • 8,862
  • 3
  • 27
  • 30
  • Is the path to the submodule's source accessible over the [internet](https://help.github.com/articles/using-submodules-with-pages)? Check the `.gitmodules` file of your project. – Bleeding Fingers Apr 24 '13 at 09:27
  • how would that work? either it’s a git repo or a not. If you want it to be an ordinary folder, delete the `.git` in there. – Chronial Apr 24 '13 at 09:38
  • .gitmodules doesn't exist for my project because I never manaually inteded to make a git submodule. Every command relating to submodules just returns No submodule mapping found in .gitmodules for path 'projectpath'. @Chronial it is a git repo, but it's not linked to github, it's only there for deployment purposes but I still need to share the code with my team. – Xiv Apr 24 '13 at 11:15
  • Do you want the files inside that subfolder to be part of the outer repo or to be ignored by the outer repo? Regarding the general issue: This is a “submodule”. Git will store any git repository within another as a submodule. The whole submodules stuff is only there for git to know how to access this submodule. – Chronial Apr 24 '13 at 11:57
  • @Chronial The problem is that because the "submodule" is actually a heroku repo, that git can't access - it means that the files aren't being saved anywhere. I want it to be part of the outer repo as an ordinary folder. – Xiv Apr 25 '13 at 08:10
  • 1
    k, but you realize that that will get you into ugly trouble if you do any checkout in either of them? Because then the working dir of the other one has changed and it doesn’t know why and will assume that you did those changes manually etc. Did you have a look at `git submodule` and `git subtree` and are you sure that one of them might not be a better solution here? (It looks to me like you might more be looking for `git subtree`) – Chronial Apr 25 '13 at 08:23

2 Answers2

1

The solution lies in adding them as submodules to git. Info found here: http://git-scm.com/book/en/Git-Tools-Submodules.

You need to go to the home directory, and do:

git submodule add git://github.com/<something>.git <name>

Then later, when you pull your directory, you can have it recusrively pull all the submodules also with:

git submodule init
git submodule update
Xiv
  • 8,862
  • 3
  • 27
  • 30
0

It appears that repo submodules are displayed in green on github's website. Not saying this through practical experience though, since I have never created a github repo containing submodules, but through observation.

Source this, this and this.

Community
  • 1
  • 1
Bleeding Fingers
  • 6,993
  • 7
  • 46
  • 74