Use gitattributes to modify how GitHub detects file types. See Overrides.
Git config includes.
Repos organized by the identity:
~/src
|-- work
|-- work-repo-1
|-- work-repo-2
|-- other
|-- other-repo-1
|-- other-repo-2
.gitconfig:
[user]
name = Bruce Wayne
email = bruce@wayneenterprises.com
[includeIf "gitdir:~/src/other"]
path = .gitconfig-other
.gitconfig-other:
[user]
name = Batman
email = darkknight@justice.league
Check the effective configuration:
git config --list --show-origin --show-scope
Useful only with large monorepos, don't use with normal smallish repos. See e.g. Get up to speed with partial clone and shallow clone.
Shallow clones are good for single builds:
git clone --depth=1 --single-branch --branch=<BRANCH> <REPOSITORY_URL>
Partial (blobless) fetches some blobs later on-demand:
git clone --filter=blob:none <REPOSITORY_URL>
Submodules are separate repositories that are linked to the main (super) repository. They are useful for including libraries or other dependencies in the project without merging them into the main repository. The history of the main repository and the submodule(s) are kept separate.
Add a submodule to an existing repository:
git submodule add <REPOSITORY_URL> <PATH>
Clone a repository with submodules:
$ git clone --recurse-submodules <REPOSITORY_URL>
If you forgot to use --recurse-submodules in clone, you can still initialize and update the submodules:
$ git submodule update --init --recursive
Update all submodules (tracks the submodules' default branches):
$ git submodule update --remote
Pull a repository with submodules:
$ git pull --recurse-submodules
Recommended configuration:
# no need to specify --recurse-submodules except for clone command
git config --global submodule.recurse true
Source: git.md Created: 2023-10-18T15:48:10+03:00 Changed: 2025-05-20T12:17:31+03:00