Skip to content

mkdocs build cleaning removes .git when site_dir points to a parent directory #346

Description

mkdocs build --clean wipes out the project when attempting to split doc development and mkdocs' build output across two git branches (gh-pages, gh-pages-dev) with the following layout:

<branch: gh-pages-dev>
$PROJ_ROOT/
|- dev
`  |- doc/
   `- mkdoc.yml  \# NOTE: site_dir=../

<branch: gh-pages>
$PROJ_ROOT/
`- ... \# build output

This is so I can both keep everything in the same project and also track the dev/ directory on the dev branch and have the output where it should be on the gh-pages branch. It seems obvious now that this would wipe out everything including the .git/ for the project (glad this was a test). Possibly, it could recursively check site_dir for a .git, warn and exit. Or just a disclaimer here of this possibility would be enough, so no one else tries this and wipes out their project (and maybe you could recommend to new users how to maintain site development and build output in the same repo).

Thanks,
Kris

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions