Adding totp as a submodule to keyvault:
-
Navigate to
keyvaultrepository:cd path/to/keyvault -
Add
totpas a submodule:git submodule add https://github.com/username/totp.git totp -
Commit the submodule addition:
git commit -m "Added totp submodule" -
Push changes to remote repository (if needed):
git push origin main
Updating files in keyvault/totp:
-
Navigate to the submodule directory:
cd path/to/keyvault/totp -
Make changes as needed (add, edit, delete files).
-
Commit changes within the submodule:
git add . git commit -m "Updated files in totp submodule" -
Push changes to the submodule's remote repository:
git push origin main -
Navigate back to the main repository (
keyvault) and commit the submodule reference update:cd .. git add totp git commit -m "Updated totp submodule reference" -
Push changes to
keyvaultrepository:git push origin main
Notes:
-
Cloning with submodules: If you clone
keyvaultrepository to a new location, usegit clone --recurse-submodules https://github.com/username/keyvault.gitto also clonetotpsubmodule. -
Updating
totpsubmodule to latest commit: Insidekeyvaultrepository, navigate tototpsubmodule and usegit pull origin main(assumingmainbranch) to update to the latest commit.
To remove a submodule from a Git repository, such as totp from keyvault, you need to follow these steps:
-
Delete the submodule entry:
- Open your terminal and navigate to the
keyvaultrepository. - Remove the submodule entry from
.gitmodulesfile:
Replacegit submodule deinit -f path/to/submodulepath/to/submodulewith the path to your submodule directory (totpin this case).
- Open your terminal and navigate to the
-
Remove submodule from the index:
- Remove the submodule from the Git index:
Again, replacegit rm --cached path/to/submodulepath/to/submodulewith the actual path.
- Remove the submodule from the Git index:
-
Delete submodule files:
- Delete the submodule files (optional, depending on your use case):
Ensure you don't need any of the submodule's files before doing this.rm -rf path/to/submodule
- Delete the submodule files (optional, depending on your use case):
-
Commit the changes:
- Commit the removal of the submodule:
git commit -m "Removed submodule totp"
- Commit the removal of the submodule:
-
Push changes to remote repository (if needed):
- Push the changes to your remote repository:
git push origin main
- Push the changes to your remote repository:
These steps will remove the submodule totp from your keyvault repository. Be cautious when deleting submodule files (step 3) to avoid accidental data loss.
To update a submodule (totp) in your keyvault repository to the latest commit of its original repository (totp repository), follow these steps:
-
Navigate to the submodule directory (
keyvault/totp):cd path/to/keyvault/totp -
Fetch and merge changes from the submodule's remote repository (
totprepository):git pull origin mainReplace
mainwith the branch name oftotprepository if it's different. -
Commit the updated submodule reference in
keyvault:cd .. git add totp git commit -m "Updated submodule totp to latest commit" -
Push changes to
keyvaultrepository:git push origin main
Notes:
- The
git pull origin maincommand insidekeyvault/totpupdates the submodule to the latest commit oftotprepository'smainbranch (adjust branch name as needed). - After updating the submodule in
keyvault, you commit and push the updated submodule reference (keyvault/totp) to reflect the latest changes fromtotp.
This process ensures that keyvault is using the most recent version of totp submodule, aligned with the changes made in its original repository (totp).