0

In a project that uses directories or files as part of presentation, you might want to ship some examples. But if those examples actually affect the final presentation, the expectation would be for the user to delete the example files and use their own.

I'm specifically referring to a scenario like this: https://github.com/lipupini/lipupini/tree/5.1.0/collection

The example directory is tracked since it needs to be available when cloning for the first time to get up and running and see how it works. If the directory is eventually deleted (as would be expected), is there a way to help ensure that the deleted example directory doesn't get recreated by Git later after deleting?

3
  • It depends on what the example directory is used for. There is no command that would exclude a directory when pulling changes (without showing up as changes). The user could be instructed to add a file .hidden (which is added in `.gitignore) to the example directory once they are done with it. The software then checks for the file before doing its thing. This has the upside that users could activate the examples again if they want to. Commented Apr 18, 2024 at 11:44
  • The example directory in the case of Lipupini is to provide an example of how a collection of documents can be structured, and to minimize bottlenecks between git clone and actually being able to tinker with it before adding their own documents. The .hidden idea could be a good track. I seem to remember there being a way to ignore a file yet have it in the repository for first pull. The concern is in a case where someone just wants to pull in the latest changes, if they've deleted the example directory then I think it'll probably be put back. Commented Apr 19, 2024 at 19:13
  • Yes a git pull would receive the updated example directory again, of course. To me it makes sense that I shouldn't edit the example directory if its part of the repo. You could also have the directory named workspace.example with examples, have workspace be an empty directory which only has .gitkeep and in .gitignore you ignore everything else in workspace. Instruct users to copy the workspace.example directory to the workspace directory to try out the examples. Or just have the workspace directory a parameter / setting that can even be outside the repo. Commented Apr 23, 2024 at 11:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.