Project mode allows you to easily track changes with Git, the most popular version control system. But often, you don’t want to track all the files of your project in the Git repository. 4D now offers you the possibility to define what not to track in your new projects.
When you create a 4D project and a Git repository for it, Git will track all changes in the project folder. But it’s not necessarily relevant to track all the files placed in the project folder. For example, tracking binary files that are constantly updated, such as the data file, is rarely relevant. This also applies to users’ files or working files.
Git lets you specify the files you want to exclude from the repository using a .gitignore file. You can learn more about .gitignore files on the official Git documentation website.
From now on, 4D gives you the possibility to automatically add a default .gitignore file in your project folder. The file is taken into account at the first commit. A new checkbox is available in the preferences dialog:
Once you activate this option, all your new projects will include the following .gitignore file:
And here are its default contents:
This default file will exclude the following elements from the repository:
– the Data folder. It may better to back it up with 4D.
– the DerivedData folder is a working folder. 4D rebuilds it automatically when needed.
– the Libraries folder is a working folder. 4D rebuilds it automatically when compiling for Silicon on macOS.
– the developer’s user preferences
– the trash is not excluded by default, but if you want to exclude it, just remove the comment (# )
– the files automatically generated by macOS and Windows in folders containing pictures
Reminder: Files and folders mentioned in the .gitignore file are case-sensitive.
The cherry on the cake, you can define your own default .gitignore file by clicking on the button at the right of the checkbox in the preferences dialog. A text editor will then open your own default .gitignore file. You can modify it as you want, and it will be included in all your new projects, thus limiting time loss and oversights!