Blog |

How to Resolve .gitignore Change Tracking Issues on Dynamics 365 Finance and Supply Chain Management

Monday, February 21, 2022
Reading time: 3 minutes

Have you ever been in a situation where you finish developing some Microsoft Dynamics 365 Finance & Supply Chain Management customization, build your code without any errors or best practice warning leftovers, but once you’re ready to push your code to GIT codebase, the changes that you’ve done are not visible in the Visual Studio GIT changes form?

It might be because you‘re using ![Package dir]/** instead of ![Package dir]** in K:\AosService\PackagesLocalDirectory\.gitIgnore file.

This file defines which directories should be tracked by GIT. Usually GIT should not track any of the standard modules or any of binaries that reside in the local packages directory, therefore a */** command is placed at the top.

Figure 1. K:\AosService\PackagesLocalDirectory\.gitIgnore file‘s content

The only directories that should be tracked are the package directories which store your team‘s developed customizations modules. These packages should be excluded from the ignored directories list as GIT documentation suggests with ![Package dir]/**.

Figure 2. K:\AosService\PackagesLocalDirectory\.gitIgnore file‘s content

However, the ![Package dir]/** command matches only the child directories that reside inside parent directory and not the actual files.

In order for GIT to stop ignoring the files in a chosen directory, the ![Packages dir]** command should be used instead.

Figure 3. K:\AosService\PackagesLocalDirectory\.gitIgnore file‘s content

This command tells GIT to track every K:\AosService\PackagesLocalDirectory child directory and file that starts with [Packages dir] symbols.

In the CustomizationsPackage directory, another .gitIgnore file should be created to exclude the module descriptor, the module directory in which created object’s XML files are located, and current .gitIgnore file from ignored item’s list.

Figure 4. K:\AosService\PackagesLocalDirectory\CustomizationsPackage\.gitIgnore file‘s content

Now your customizations will be shown in the Visual Studio Git changes form and can be pushed to remote repository in seconds.

We hope that these tips on how to fix the common .gitignore issue appearing on Dynamics 365 Finance and Supply Chain Management code and Visual Studio were helpful and saved you the time you would have spent trying to figure out what was going wrong! If you need further help or advice from our product experts on other development areas, we provide technical Dynamics 365 Finance and Supply Chain Management consulting for Partners on their Dynamics 365 Finance and Supply Chain Management customer implementation or ISV solution development projects.

Check out what we offer and request your consultancy today!