0

I'm working on a pre-existing Laravel project hosted on github and I've set up my development environment with laradock. I cloned the laradock repo on my project root using git submodule add https://github.com/LaraDock/laradock.git

When I switch to a different git branch however the laradock folder is emptied. I run git submodule add https://github.com/LaraDock/laradock.git again and get the message

A git directory for 'laradock' is found locally with remote(s):
  origin    https://github.com/LaraDock/laradock.git
If you want to reuse this local git directory instead of cloning again from
  https://github.com/LaraDock/laradock.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.

So I run with the --force option and it returns. But surely I shouldn't have to do this every time I change branches?

sayan saha
  • 91
  • 2
  • 8
ellcub
  • 601
  • 5
  • 9
  • I don't really get what you're trying to do here. On what branch are you trying to switch ? Have you fetched your remote branches with `git fetch` ? If your branches represents an empty version of your submodule, then it is absolutely normal that you have no files and you should not add it as a submodule again. – Val Berthe Jan 30 '17 at 15:54
  • I'm trying to switch a branch on the main project (not the submodule). For example I want to work on a new feature for the main project so I create a new branch, but then my development environment is gone (the submodule laradock) – ellcub Jan 30 '17 at 16:00

1 Answers1

0

I deleted everything and started again.

I think this problem may have occurred because I had added laradock/ and .gitmodules to .gitignore.

ellcub
  • 601
  • 5
  • 9