base_ui/GIT_SUBMODULE.md
Mehdi104797 f2fee4c45f .
2025-03-15 08:03:14 +03:30

53 lines
1.6 KiB
Markdown

Add new repo:
git submodule add https://git2.tavasi.ir/front/chat_ui.git systems/chat_ui -f
Cloning a Repository with Submodules
If you clone a repository that contains submodules, you'll need to initialize and update the submodules:
git clone <repository-url>
cd <repository-directory>
git submodule init
git submodule update
Or, you can do it in one step:
git clone --recurse-submodules <repository-url>
Updating Submodules
To update a submodule to the latest commit on its branch:
git submodule update --remote
## How to Remove an Existing Submodule
If the path was previously added as a submodule, you need to remove it completely before re-adding it. Follow these steps:
1. Remove the submodule entry from .gitmodules.
2. Remove the submodule from the working tree and index: git rm --cached <path-to-submodule>.
3. Delete the submodule directory: rm -rf <path-to-submodule>.
4. Stage the .gitmodules changes: git add .gitmodules.
5. Commit the changes: git commit -m "Removed submodule <submodule-name>".
errors:
# repo already exists and is not a valid git repo
Check if the path is already tracked
git ls-files --stage systems/chat_ui (100644 <hash> 0 <path>)
If it is, remove it from the index
git rm --cached systems/chat_ui
If system/chat_ui exits, remote it(chat_ui)
rm -r systems/chat_ui
Add the submodule
git submodule add https://github.com/example/repo.git systems/chat_ui
Commit the changes
git commit -m "Added submodule at systems/chat_ui"
Verify the submodule
git submodule status
(Optional) Initialize and Update the Submodule
If the submodule was added successfully but not initialized, run:
git submodule update --init --recursive