Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

Git for the SalesLogix Developer - Using the .gitignore to Exclude Files in Your Model

When using Git, or really any source control system, you don't want everything in your SalesLogix model to be under source control. There are some files that the Application Architect uses for it's own purposes and volatile files that have no importance for your purposes and are recreated as needed. These files that change often with no importance to what you're working on can make things difficult when working with source control since every time a developer pushes changes, that are pulled by another developer these files will need to be merged. Doing this every time will get old fast. Git has the built in ability to exclude files from source control. Let's take a look at how.

View the Git for SalesLogix Developers series index

The .gitignore file

Git uses a simple text file, named .gitignore, that you can use to enter file names, paths, or file name or path patterns to exclude from your Git repository. These files will still exist on the file system. Git just won't keep track of them and won't include them when you push changes. This way, each developer can have their own file that is independent of what you're working on. This .gitignore file is nothing more than a list of files & paths that are not being tracked by Git and will be ignored. To create a gitignore file all you need to do is create a text file and then place it in the root of your Git repository - in our case it will be the root of your SalesLogix model folder.


What to Exclude from a SalesLogix Model

As I mentioned earlier, there are some files in a SalesLogix model that you don't want to include in the Git repository. These are the main items to exclude:

  • ModelIndex.xml - This file is a temporary cache created by Application Architect as you access objects. This file can be deleted and will be automatically created again as needed. This is a volatile file and if included in source control would require constant merging with no benefit.
  • Model\Deployment folder tree - The deployment folder in the model is where the Application Architect will create all of the actual SmartPart.ascx files and other deployable items from the QuickForm meta data and entities in your model. This is not to be confused with a "deployment" per se, but this is a staging area for things to be deployed that are created when you build your platform. As you create, modify, delete items in the model and then build your web platform all of the deployment files are generated based on what is in your model. Including these files in your source control system will complicate things since these files are created all over again as you build your web platform. We'll include this entire folder tree and everything in it.

In addition to those files, there are some files that is good to exclude as well. These are files that can be left behind by file merge & compare tools.

  • *.BACKUP*
  • *.BASE*
  • *.LOCAL*
  • *.REMOTE*
  • *.orig

If you're using Visual Studio and creating external assemblies for use within your SalesLogix model (if not you should be), then you'll also want to exclude these files and paths as well.

  • *.suo
  • *.cache
  • *.obj
  • *.pdb
  • *.user
  • obj/
  • Debug*/
  • Release*/

Let's see what the .gitignore file looks like with all of that together.


The Complete SalesLogix .gitignore File

This is what the complete .gitignore file would look like for a SalesLogix model:

# Files created from DiffMerge
*.BACKUP*
*.BASE*
*.LOCAL*
*.REMOTE*
*.BACKUP.*.xml
*.BASE.*.xml
*.LOCAL.*.xml
*.REMOTE.*.xml
*.orig
 
# Model files that are auto-generated
[Mm]odel[Ii]ndex.xml
 
# Standard Deploy files
[Mm]odel/[Dd]eployment
 
# Visual Studio files
*.suo
*.cache
*.obj
*.pdb
*.user
obj/
[Dd]ebug*/
[Rr]elease*/

You just create a text file, paste that in, and save it as ".gitignore" in the root of your Git repository. You can download this file zipped from me here:

 Download the .gitignore file


When Should You Use a .gitignore File?

Always.

Seriously. Every project should have a .gitignore file. There is always something you want to exclude. Or should exclude. If you don't think you need one then you might not be thinking forward enough to understand how files you're adding will effect merges for other developers. Even if you're just a single developer today, you never know what the future will bring.

Adding the .gitignore file right at the start of the project will save you many headaches later. Once a file is tracked by Git, adding it to the .gitignore won't remove it from Git control. You have to manually remove the file from Git control, then it can ignore it. Also, if you add the .gitignore after other developers have pulled the repository and have made changes, you're really going to screw things up since when they pull, and get your .gitignore file, and they've modified files you've told Git to ignore - clear your afternoon. You'll be practicing your cursing skills. So, always remember, add the .gitignore before you ever do your first commit, and for sure before you do your first push.


Using Git Extensions for SalesLogix

If you're using Git Extensions for SalesLogix, it will automatically create the .gitignore file for you, with the entries I mentioned above. You can read more about that here: Excluding SalesLogix Model Files from Source Control

View the Git for SalesLogix Developers series index

What's This?
  
Bookmark and Share

About Ryan Farley

   Ryan Farley is the Director of Development for Customer FX Corporation and the creator of slxdeveloper.com.

Don't miss these developer series from Ryan:


Related Content
   Can the SalesLogix Application architect's build process be automated?
Can the SalesLogix Application architect's build process be automated, or called from a batch file? W
Posted on May 16, 2013 by SalesLogix Support to SalesLogix Questions & Answers
 
   Is it possible to Sync SalesLogix Attachments based on Account Manager?
Is it possible to only sync SalesLogix Attachments from the accounts where the user is the account manag
Posted on May 15, 2013 by SalesLogix Support to SalesLogix Questions & Answers
 
   SalesLogix Remote Library Management
Is it possible to log into a SalesLogix Remote Database as Admin and Manage the Library Files?
Posted on May 14, 2013 by SalesLogix Support to SalesLogix Questions & Answers
 
   Demystifying SalesLogix Web: Dashboards and Analytics Tools
Join us for a free webinar, Wednesday, May 15th at 2pm CDT. The SalesLogix Web dashboards and analytics
Posted on May 08, 2013 by Brianna Tinjum to The Inbox
 
   What is the Difference Between Left Joins and Inner Joins in SalesLogix?
Question: What is the difference between Left joins and Inner joins in SalesLogix?
Posted on May 07, 2013 by SalesLogix Support to SalesLogix Questions & Answers
 
Comments

 

Twitter Trackbacks for Git for the SalesLogix Developer - Using the .gitignore to Exclude Files in Your Model - Ryan Farley's Blog [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Git for the SalesLogix Developer - Using the .gitignore to Exclude Files in Your Model - Ryan Farley's Blog         [customerfx.com]        on Topsy.com

September 24, 2010 7:46 AM
 

Kevin said:

I notice you don't have *.delete*or */Deleted Items/* included in the .gitignore.  Should those files be kept under source control?

August 9, 2011 10:53 AM
 

Ryan Farley said:

Hi Kevin,

I like to keep the deleted items in the model. This way, Dev1 can delete items from the model and then push the change. Dev2 can then pull the repo and can bundle up the delete to deliver. Later, the decision might be made to bring back a deleted item which any of the devs can do since they all share the same deleted items.

-Ryan

August 9, 2011 11:10 AM
 

Kevin said:

Makes sense.  Thanks for the quick response!

August 9, 2011 11:16 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2013 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register