選擇a(使用原來的repo,刪除ios目錄,更新目錄)

選擇a(使用原來的repo,刪除ios目錄,更新目錄)

這張圖片是我的 git 專案:

這張圖片是我的 git 專案。

我的 git 儲存庫中有兩個項目,Android 和 IOS。不過我不再需要 IOS 專案了。

所以我希望我的 android 專案是 git 的根目錄,並將先前的提交日誌保存到新的儲存庫中。

我嘗試將 android 專案資料夾複製到新目錄並將先前專案的 .git 資料夾複製到其中,但將其推送到新儲存庫後,它不起作用。 IOS 資料夾仍然發布。

您還知道其他的方法嗎?我該怎麼辦?

請給我幫忙。

答案1

社區不鼓勵使用圖片,因為圖片不容易搜尋和查看,嘗試這樣做
project/
├── project/
│   ├── .git
│   ├── android 
│   ├── ios
1. git 不直接追蹤根目錄之外的任何內容,首先將我們的結構簡化為這樣
project/
├── .git
├── android 
├── ios
2. 不要自己移動任何.git 目錄。這是沒有意義的。它包含了之前所有的ios目錄資訊。

==================================================== = =============================

選擇a(使用原來的repo,刪除ios目錄,更新目錄)

3.假設您刪除了ios資料夾或將其移動到其他地方

project/
├── .git
├── android 

4. 仍然在遠端追蹤 ios 目錄,以暫存更改,

git add . 
git commit -m "removed the whole ios folder"
git push 

==================================================== = =============================

選擇b,使用另一個repo,保留ios目錄在原來的位置,將你的android目錄移動到其他地方(不推薦,你的android的commit歷史記錄都消失了)

在包含 android 目錄的目錄中,

git init 

git add .

git commit -m "first commit"

git remote add origin <your url of repo>
git push -u origin master

相關內容