List your local Git repositoriesλ︎
SPC g L
will list all the repositories along with basic status information (branches, dirty, etc). This is very useful as the number of created or cloned repositories grows on your computer.
You first need to tell Magit where your repositories are on your computer.
Configure the location of your Git repositoriesλ︎
magit-repository-directories
is used to define which directories Magit should search in to find your Git repositories. This configuration should be added to the dotspacemacs/user-config
section of your .spacemacs
file.
In the following example the Git repositories are all under a directory called projects
in your home directory. It also specifically adds the Spacemacs repository in .emacs.d
.
The number represents the depth of subdirectories in which magit searches for Git repositories in the specified directory.
Hint:: Setting repository directories changes Magit Status behaviourλ︎
SPC g i
should be used to initialize a new git repository oncemagit-repository-directories
is set.If you use
SPC g s
on a project that has no git version control, magit will prompt you for a git repository. Enter.
to initialise a new git repository in the current project. Magit will prompt you in the mini-buffer to confirm you wish to create this git repository.