0

I have cloned a template project. I have then tore it apart, to make it my own project. Now, git believe that a subdirectory is a branch of the original template project and even when I run git add . -A it does treat it as it was a repository.

When I was getting in the sub, the powershell was indicating that I was getting in a new repo. I executed rm -rf .git in the subdirectory.

Now however, git status says that the branch is up to date but in the master what I have is just an empty directory, while in origin I have all my code.

I tried this with no success.

Community
  • 1
  • 1
NoIdeaHowToFixThis
  • 4,484
  • 2
  • 34
  • 69
  • Maybe your directory is a submodule. Try `git submodule` to see if your directory appears there. If not, please be more specific and explain why you think that git treats the subdirectory as a repo. – Tobias Müller Aug 10 '15 at 09:05
  • looks like submodule check http://git-scm.com/docs/git-submodule – Robert Aug 10 '15 at 10:12

3 Answers3

1

Your subdirectory is a submodule, so you should use git submodule instructions, as below -

git clone <main app>
cd main_app
git submodule init
git submodule update 
Vishnu Atrai
  • 2,370
  • 22
  • 24
0

No trick did the job. I have just had to delete the repository and start from scratch. Ugly, but got the job done.

NoIdeaHowToFixThis
  • 4,484
  • 2
  • 34
  • 69
0
  1. Go to the subdirectory (let's say subDir) parent from where it is treated as it own repo.
  2. Now, You're in main git repo
  3. Change the name of that subdirectory (let's say subDir1).
  4. git pull origin <your branch> (it will pull changes from remote)
  5. Now you'll see that subDir and its name changed directory subDir1.
  6. Remove subDir1

Now, subDir and it's content will be part of your main repo.

Matthijs
  • 2,483
  • 5
  • 22
  • 33
Vikash
  • 1