0

When I get a fresh copy of whatever lives in a git repository, I may be getting some changes to the project YAML files.

So far, so good.

When Craft detects that those files contain un-applied changes, it will say:

"Your project config YAML files contain pending changes."

What I want to know is, when I apply those changes, is it always a files --> db sync, or will there ever be a db --> files sync?

Does it also perform other changes in files or is this always a sync into the database and nothing else?

I want to know this to be aware of what is going on in my git status and predict things before they happen.

Working with Windows WSL2 is really a pain regarding file permissions, sometimes I find myself with modified project files that I don't want to commit and my only option is to do a git reset, because reverting them is problematic with WSL2.

1 Answer 1

2

Applying the project config will always be a onedirectional operation, it applies the state of your config/ folder to your database. Applying the project config through the control panel is the same as the project-config/apply command. To apply changes in the opposite direction (database -> config/ folder), there are the project-config/write and project-config/rebuild command, see this answer for details.

That said, it's not guaranteed that applying the project config will never perform any file system operation. Every system component and plugin can listen to project config changes and do whatever they want in reaction to those. For example, a project config change to a file system's base path may create that directory on the filesystem (not sure if that actually happens at that point, it's just an example). Other plugins may create files or move folders around as a reaction to project config changes.

That said, those changes mostly happen in folders that usually aren't tracked in git (storage, web, etc) and applying the project config should never change the contents of the config/ folder. I would ditch a plugin that does this immediately.

Working with Windows WSL2 is really a pain regarding file permissions, sometimes I find myself with modified project files that I don't want to commit and my only option is to do a git reset, because reverting them is problematic with WSL2.

This is your real problem. You can never work productively with a system you don't have full control over. Instead of trying to contain the fallout, invest the time to get your development environment under control. For example, you could:

  • Use Docker to set up a predictable, reproducible environment.
  • Install a dedicated Ubuntu installation on your Windows PC with a dual boot setup.
  • Buy a dedicated machine for development with Linux or macOS.
2
  • 1
    +1 for the advice on "Buying a dedicated machine for development with Linux or macOS". Windows really just doubles the energy required to get things done. Commented Aug 2, 2022 at 7:47
  • 1
    @ÁlvaroFranz Yeah, Windows is a pain for development. I hate to recommend Apple devices, but macOS is really much simpler for web dev, I use a Mac Mini at work. Though I have a dual boot setup with a dedicated Ubuntu installation at home, this works reasonably well, so it's a good starting point that doesn't cost anything if you've already got a Windows machine.
    – MoritzLost
    Commented Aug 2, 2022 at 8:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.