gitcocoscreator

How to prevent files from unnecessarily changing when running a freshly cloned Cocos Creator project?


How can I prevent Cocos Creator from changing files unnecessarily when I open a freshly cloned project from a GIT repository?

I created a new project and selected helloworld-typescript sample project as the start and run it. Afterwards I committed and pushed everything that wasn't ignored by the .gitignore file that the engine generated by itself.

The problem is that if I delete the local repository, clone the project again and run it, bunch of changes in GIT will appear - various .meta files and a few .json files. Is there a way to prevent this? I could try ignoring all the .meta files but I'm concerned that they may contain some important data.

Example of files that were marked as modified after running a project cloned from a GIT repository:

modified:   assets/Scene.meta
modified:   assets/Scene/helloworld.fire.meta
modified:   assets/Script.meta
modified:   assets/Script/Helloworld.ts.meta
modified:   assets/Texture.meta
modified:   assets/Texture/HelloWorld.png.meta
modified:   assets/Texture/singleColor.png.meta
modified:   project.json
modified:   settings/project.json
modified:   settings/services.json

Solution

  • Figured out the solution. It seems that the problem lies in the line endings.

    Run the following command in GIT:

    git config core.autocrlf false
    

    It will prevent GIT from doing some stuff automatically and in turn stop the .meta and .json files from getting modified every time you run the project.