0

I cloned a repository from github, and I would like to make it a directory in an other github repository. Though it is considered as a submodule (and I don't want it to be a submodule, but a directory). In this directory i have some script that I would like to push on my github repository.

When i do : git status i get this error message:

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

    modified:   my_directory (untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

I tried to do git add . ; git add my_directory and to commit it, but it's not working neither.

I don't find any .gitignore or .gitmodules...

edit :

finally i find how to do what i want, i had to delete the .git that was in my directory. Though it was an invisible file... Once this was done, i just had to do git commit -a and then git push

D Prat
  • 352
  • 4
  • 16

1 Answers1

1

If that directory has a .git/ subfolder in it, it will act as a nested git repository.

If you add that folder, you actually are adding only the tree SHA1 (gitlink) to your repo, not the folder content.

To undo that:

git rm --cached my_directory

(very important: no trailing slash: you want to delete the entry, not the folder content)

If you don't care about the history of the content, delete my_directory/.git

Then you can add, commit and push as usual: that folder will be a regular folder.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ok thanks, but i already did this without sucess. Finally i had to delete the .git in my directory that i wasn't able to see it... – D Prat May 01 '18 at 16:56
  • If you delete the.git of your subfolder, and do a git rm --cached as instructed, then you will be able to add that subfolder content. – VonC May 01 '18 at 16:59