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:
/path/to/huge/repo/.dir-locals.el
((nil . ((magit-refresh-buffers . nil))))
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:
/path/to/tag/invested/repo/.dir-locals.el
((magit-status-mode . ((eval . (magit-disable-section-inserter 'magit-insert-tags-header)))))
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:
/path/to/huge/repo/.git/config
[include] path = /path/to/huge-gitconfig
/path/to/huge-gitconfig
[status] showUntrackedFiles = no
$HOME/.emacs.d/init.el
(dir-locals-set-class-variables 'huge-git-repository '((nil . ((magit-refresh-buffers . nil))))) (dir-locals-set-directory-class "/path/to/huge/repo/" 'huge-git-repository)