ADR 001
An interesting thought came to my mind, simplify the logic further and use git config core.worktree . It sounded like an amazing solution, using git to store all the info, great right? So I checked it out:
I tried git config core.worktree ../gits in a test repo and guess what ?
Got this message first: fatal: cannot chdir to '../gits': No such file or directory
Okay I tried ...
❯ git config core.worktree
fatal: cannot chdir to '../gits': No such file or directory
Nope , all the git commands status, pull , remote failed at this point.
Finally I solved by setting the env var: GIT_WORK_TREE
In short , I realized something very important. Devs tend to move git repos here and there. Its important that the worktree shouldn't be hardcoded at any point of time.
Conclusion
Use env var : GIT_WORK_TREE over git config core.worktree over initialization
ADR 001
An interesting thought came to my mind, simplify the logic further and use
git config core.worktree. It sounded like an amazing solution, using git to store all the info, great right? So I checked it out:I tried
git config core.worktree ../gitsin a test repo and guess what ?Got this message first:
fatal: cannot chdir to '../gits': No such file or directoryOkay I tried ...
Nope , all the git commands
status, pull , remotefailed at this point.Finally I solved by setting the env var:
GIT_WORK_TREEIn short , I realized something very important. Devs tend to move git repos here and there. Its important that the worktree shouldn't be hardcoded at any point of time.
Conclusion
Use env var :
GIT_WORK_TREEovergit config core.worktreeover initialization