relocate git's COMMIT_EDITMSG

Viewed 160

By default, Git tries to open COMMIT_EDITMSG in the actual repo -- which is sane. But if the repo is on a slow disk (e.g. external USB drive, network fs etc) the editor startup / exit time can suffer.

Short of relocating the repo, or just the .git folder associated with the repo (e.g. .git file), is there any other way to make COMMIT_EDITMSG go to /tmp? I've looked at the hooks but they don't seem to be able to set the location of the file AFAICT.

1 Answers

I think the solution is to rely on the extended way to use the git clone command.

You can tell to git client to relocate the while .git folder by:

git clone --separate-git-dir={{.git folder path}} {{repo URI}}

Without the above feature you may try to link the file stored in anothet path like follow:

mv {{repo-folder}}/.git/COMMIT_EDITMSG {{my-custom-path}}/COMMIT_EDITMSG

ln -s {{my-custom-path}}/COMMIT_EDITMSG {{repo-folder}}/.git/COMMIT_EDITMSG
Related