GIT
Git is one of the most common Version Control systems today.
Common Commands
Prune local branches
git remote update origin --prune
Submodules
Update all submodules after first checkout of repo
git submodule update --init --recursive
Update all submodules in subsequent commits
git submodule update --recursive --remote
Check out all submodules to main
git submodule foreach 'git checkout main'
Pull all submodules from origin
git submodule foreach git pull origin main
Remove a submodule from the repository
To remove a submodule you need to:
- Delete the relevant section from the
.gitmodulesfile. - Stage the
.gitmoduleschanges:git add .gitmodules - Delete the relevant section from
.git/config. - Remove the submodule files from the working tree and index:
git rm --cached path_to_submodule(no trailing slash). - Remove the submodule's
.gitdirectory:rm -rf .git/modules/path_to_submodule - Commit the changes:
git commit -m "Removed submodule <name>" - Delete the now untracked submodule files:
rm -rf path_to_submodule