/platformsdirectory under version control
/platforms and similar folders are in the
.gitignore file of Cordova projects. This means the whole generated iOS and Android projects don’t take up space in your repository - they can be recreated by running the
(ionic) cordova build command.
But when we work with
fastlane, it can be beneficial to know what our code changed in the native projects (and being able to simply revert all the things we messed up…). As we are using git, somehow versioning
/platforms is a simple way to achieve this.
Important: You don’t have to do this to use Fastlane. All the actual Fastlane files live in
/fastlane in your project. But as some of the more advanced Fastlane actions also manipulate your native projects understanding what happens in
/platform can help to understand what happens and avoid problems.
There are two way to achieve this: (I personally prefer option b) as it is easier to revert)
/platformsfrom the default
If you have no problem with all the
platforms files and folders being in the main Git repository of your project, you can just remove
/platforms from the
.gitignore file in your favorite editor. Remove or uncomment (
#) this line:
Commit and push the edited
.gitignore file, which should also add all the files and folders inside
/platforms to git automatically. The folder is now under the same version control as the rest of your project.
I suggest you commit changes to the normal project seperate from the changes in
platforms. Only then commit the changes in there and use the command (e.g.
(ionic) cordova build and
(ionic) cordova prepare) as the commit message. This makes it easy to follow the changes.
If you prefer to keep the project repository lean and without
/platforms, you can just create a git repository in
/platforms itself to track (and undo, if necessary) any changes:
cd platforms git init git add . git commit -m "Initial commit"
Now you have a local git repository for
platforms that of course can also pushed to your favorite repository host.
I suggest you check for changes in the
platforms repository after every command that might have changed the native project files.
(ionic) cordova build and
(ionic) cordova prepare are the most obvious ones, but also several
fastlane commands we will use might change things there.
When changes are detected, commit them and note the command you ran in the commit log. That way you get a neat history of changes to your native projects as you have it for your main project. This not only makes following the changes much easier, but will also help you identify if something goes wrong.