Git - Moving the .git directory to another drive, keep the source code where it is

前端 未结 4 1385
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-23 15:02

I have my source code and .git folder on a small fast ssd, I would like to have the .git directory on my second bigger slower hdd and keep my working code on my fast smaller

4条回答
  •  眼角桃花
    2020-12-23 15:23

    The --separate-git-dir method is exactly the same as the gitdir approach.

    After running

    $ git init --separate-git-dir=[path to directory for .git data]
    

    what happens is that a .git file is created in the local directory with the following content:

    gitdir: [path to directory for .git data]
    

提交回复
热议问题