Next: , Up: Customizing   [Contents][Index]

9.1 Per-Repository Configuration

Magit can be configured on a per-repository level using both Git variables as well as Emacs options.

To set a Git variable for one repository only, simply set it in /path/to/repo/.git/config instead of $HOME/.gitconfig or /etc/gitconfig. See the git-config(1) manpage.

Similarly, Emacs options can be set for one repository only by editing /path/to/repo/.dir-locals.el. See (emacs)Directory Variables. For example to disable automatic refreshes of file-visiting buffers in just one huge repository use this:

It might only be costly to insert certain information into Magit buffers for repositories that are exceptionally large, in which case you can disable the respective section inserters just for that repository:

Function: magit-disable-section-inserter fn

This function disables the section inserter FN in the current repository. It is only intended for use in .dir-locals.el and .dir-locals-2.el.

If you want to apply the same settings to several, but not all, repositories then keeping the repository-local config files in sync would quickly become annoying. To avoid that you can create config files for certain classes of repositories (e.g., "huge repositories") and then include those files in the per-repository config files. For example: