2017-01-30 73 views
-1

我正在研究github上託管的預先存在的Laravel項目,並使用laradock設置了我的開發環境。我使用 git submodule add https://github.com/LaraDock/laradock.git當我切換git分支時,laradock子模塊清空

克隆了我項目根目錄下的laradock回購當我切換到其他git分支但是laradock文件夾被清空時。我再次運行git submodule add https://github.com/LaraDock/laradock.git,看到消息

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. 

所以我用--force選項運行和返回。但是,當我每次更換分支時,我肯定不應該這樣做。

+0

我真的不明白你想要在這裏做什麼。你試圖切換哪個分支?你用'git fetch'獲取了你的遠程分支嗎?如果您的分支代表您的子模塊的空白版本,那麼您沒有文件是絕對正常的,您不應該再次將其作爲子模塊添加。 – Ksyqo

+0

我正試圖切換主項目上的分支(而不是子模塊)。例如,我想爲主項目創建一個新功能,所以我創建了一個新分支,但隨後我的開發環境消失了(子模塊laradock) – ellcub

回答

0

我刪除了所有內容並重新開始。

我認爲這個問題可能發生是因爲我添加了laradock /和.gitmodules到.gitignore。