2

Usually, the .git directory resides inside the working tree of a non-bare repository, but there also might be .git file instead with an gitdir: <path> entry pointing to the admin-directory.

Is there a Git command that can move the directory around converting from .git directory to .git file or visa versa?

Thomas S.
  • 5,804
  • 5
  • 37
  • 72
  • you should be able to just copy/move it yourself and create the file – Mischa Oct 12 '17 at 06:33
  • 2
    Possible duplicate of [Git - Moving the .git directory to another drive, keep the source code where it is](https://stackoverflow.com/questions/17913550/git-moving-the-git-directory-to-another-drive-keep-the-source-code-where-it) – 1615903 Oct 12 '17 at 06:55

1 Answers1

2

Is there a Git command that can move the directory around converting from .git directory to .git file or visa versa?

git init does that when the argument --separate-git-dir is present in the command line. The documentation explains:

--separate-git-dir=<git dir>

Instead of initializing the repository as a directory to either $GIT_DIR or ./.git/, create a text file there containing the path to the actual repository. This file acts as filesystem-agnostic Git symbolic link to the repository.

If this is reinitialization, the repository will be moved to the specified path.

axiac
  • 68,258
  • 9
  • 99
  • 134