Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up .git folder in a custom location

Tags:

git

cvs

Here's my current dir structure:

  • mygit
  • code
    • .git
    • morecode
      • mycode
  1. The code folder is monitored by git and git's files are in the usual code/.git
  2. I am working only on a piece of this code, i.e. mycode

I'd like to use git to manage my code, but I don't want its files to be put in the expected code/morecode/mycode/.git, but rather outside of the code folder, e.g. in mygit.

Any ideas how to do that?

like image 852
Albus Dumbledore Avatar asked May 01 '26 00:05

Albus Dumbledore


1 Answers

Also, instead of using a symbolic link, you can simply make .git a regular file and put a path in it:

$ echo gitdir: /path/to/gitdir > .git
like image 62
William Pursell Avatar answered May 03 '26 21:05

William Pursell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!