Skip to content

ADR 001 : why not git config core.worktree ? #6

Description

@laciferin2024

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions