开发者

Setup git-dir and git-work-tree on TortoiseGIT

开发者 https://www.devze.com 2023-02-01 20:32 出处:网络
I am trying to understand if I can setup --git-dir and --git-work-tree params in TortoiseGIT. I have the working directory in a storage unit, and I can\'t keep .git directory there because its backup

I am trying to understand if I can setup --git-dir and --git-work-tree params in TortoiseGIT. I have the working directory in a storage unit, and I can't keep .git directory there because its backup is done once a day and there would be a lot of wasted space, so I must put my .git dirs in another place.

This works if I use GIT console and I do all the things described on progit, 开发者_JAVA百科to setup GIT_DIR environment variable.

Is there any way I can do this with TortoiseGIT? I hoped that there were a file like .gitignore to tell git where to find .git dir, but I got nothing so far.

If you know other GUIs that allow to do this it will be useful.

Any help appreciated, thanks, Michele

PS: I cannot store my projects in another place and I'd prefer to not to merge both ways everytime I work on projects because I don't know if someone else worked there. So GIT_DIR solution is the best thing I've got so far.


You could do this by doing the following :

  • move your .git folder elsewhere (PATH_TO_A_NEW_GIT_FOLDER)
  • run the following command in your source folder

git init --separate-git-dir="PATH_TO_A_NEW_GIT_FOLDER"

This will put a .git file in your source folder that will point on this new folder.

  • you're done, TortoiseGit will use your new git folder as if this one is in your source folder
0

精彩评论

暂无评论...
验证码 换一张
取 消