40923250 cp2020

  • Home
    • Site Map
    • reveal
    • blog
  • First
  • Hw1
    • PCH18
      • Laptop and Notebook Component Replacement
      • Troubleshooting Hard Drives
    • PCH19
      • Overview
      • AC Power
      • Proper Disposal Procedures
      • Security
  • HW2
    • 2-1 取得一甲分組數列
    • 2-2 是否有人加退選
    • 2-3 產生W3網頁html
  • Hw3
    • 14.移除重複項
    • 15.倒序
    • 16.密碼生成器
  • 學習日記
    • git clone
    • 刪除submodule
    • ORError
    • ssh keygen
  • python
    • Variables 變數
git clone << Previous Next >> ORError

刪除submodule

參考資料:https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule

To remove a submodule you need to:

  1. Delete the relevant section from the .gitmodules file.
  2. Stage the .gitmodules changes:
    git add .gitmodules
  3. Delete the relevant section from .git/config.
  4. Remove the submodule files from the working tree and index:
    git rm --cached path_to_submodule (no trailing slash).
  5. Remove the submodule's .git directory:
    rm -rf .git/modules/path_to_submodule
  6. Commit the changes:
    git commit -m "Removed submodule <name>"
  7. Delete the now untracked submodule files:
    rm -rf path_to_submodule

我的作法:

進行以下動作前請先備份整個倉儲

Delete the relevant section from the .gitmodules file.

把倉儲目錄中的 .gitmodules 中的東西刪掉,(我這裡點錯了應該是.gitmodules)

Stage the .gitmodules changes:

git add .gitmodules

以 git add .gitmodules 使git追蹤變更後的 .gitmodules

Delete the relevant section from .git/config.

把 .git 資料夾中的 config 中相關 submodule 的東西刪掉

Remove the submodule files from the working tree and index:

git rm --cached path_to_submodule (no trailing slash).

以 git rm --cached cmsimde(submodule名稱)刪除 submodule

Remove the submodule's .git directory:

rm -rf .git/modules/path_to_submodule

這個我無法執行,但把倉儲目錄中的submodule(cmsimde)資料夾整個刪掉就好,警告!若是編輯完頁面push時出現問題才來刪的話,cmsimde資料夾內包含還未push上去的東西

補充:先將 .git\modules\cmsimde 備份起來後刪掉,然後第7點我沒做

補充:先將 .git\modules\cmsimde 備份起來後刪掉,然後第7點我沒做

Commit the changes:

git commit -m "Removed submodule <name>"

用 git commit -m "你剛幹了啥" 提交

刪除到了這邊就結束了,要再添加submodule的話就打:

git submodule add https://github.com/mdecourse/cmsimde.git cmsimde

之後再git commit -m "submodule add"

最後push上去


git clone << Previous Next >> ORError

Copyright © All rights reserved | This template is made with by Colorlib