My Blog: Git-ifying My Project

01 January 2019

The time has come to finally move the University Package project into Git source control.

With the C1 CMS finally running well under version 6.6, and the annoying Data URL Routing bug firmly squashed, I can continue apace with the project. This means getting it into source control so that I can branch and merge features and bug fixes as necessary.

The one major issue that has been holding me back from Git-ing until now (apart from disk failures), has been getting .gitignore files to work correctly with my Visual Studio set-up. Try as I might, I just couldn't get VS to see updates to the file as I made changes to it. With the Christmas holidays giving me a chunk of free time, I was determined to nail this problem.

It turned out that I was editing the wrong file, as VS had created two repositories... one in C:\Users\Me\Source\Repro\BaileyWeb, and the other in the main C:\inetpub\C1 Bailey Web and Digital folder where I had moved the project to and was building the University Package. I couldn't see the .git folder in C:\inetpub\, as it was hidden and didn't become apparent until I browsed with command line. Turning on "show hidden folders and files" in Windows swiftly revealed what I had missed. It was a true Face-palm moment!

What to Include and Exclude

With this embarrassment out of the way, I could now manipulate the .gitignore rules to include only the files I wanted. Obviously, I didn't want to include any files from the C1 CMS, as that project has its own Git repository over on GitHub, so I only need those files that make up the University Package. The asterisks (*) in the table below indicate wild-cards, so all files that match the pattern will be included.

Folder: Files and sub-folders to include: Files and sub-folders to exclude: Notes:
/Website/App_Code/ ExecuteC1FunctionHttpHandler.cs [ALL OTHERS] Required to make the API for AJAX or Mobile Development work.
/Website/App_Data/Composite/DataMetaData/ AcademicDepartments*.xml [ALL OTHERS] These files have a GUID value after the data store name, so the wild-card is included in case the GUID changes.
AcademicYear*.xml
ApplicationMethod*.xml
AwardModes*.xml
Awards*.xml
Buildings*.xml
Campaigns*.xml
CampaignTypes*.xml
CaseStudies*.xml
Collections*.xml
Country*.xml
CountryDemo*.xml
CourseFeeBandCosts*.xml
CourseFeeBands*.xml
Courses*.xml
EducationLevels*.xml
EntryProfileQualifications*.xml
EntryProfiles*.xml
Events*.xml
Groups*.xml
GroupTypes*.xml
Honorifics*.xml
HonorificsDemo*.xml
LanguageRequirements*.xml
Locations*.xml
MainNavigation*.xml
ModuleFeeBandCosts*.xml
ModuleFeeBands*.xml
Modules*.xml
ModuleTypes*.xml
News*.xml
Organisation*.xml
Partners*.xml
PartnerTypes*.xml
People*.xml
Projects*.xml
ProjectStatus*.xml
Publications*.xml
QualificationTypes*.xml
SubjectFeeBandCosts*.xml
SubjectFeeBands*.xml
Subjects*.xml
Teams*.xml
/Website/App_Data/Composite/DataStores/ BaileyWeb.*.xml [ALL OTHERS] The content of the data stores, and the website pages and structure.
Composite.Data.Types.IPage_*.xml
Composite.Data.Types.IPage_Unpublished_*.xml
Composite.Data.Types.IPageStructure.xml
/Website/App_Data/Composite/InlineCSharpFunctions/ BaileyWeb.Data.*.cs [ALL OTHERS] All project C# fuctions.
BaileyWeb.University.*.cs
/Website/App_Data/Composite/TreeDefinitions/ BaileyWeb.University.*.xml [ALL OTHERS] The tree definitions tie the applications and page datafolders to the pages.
/Website/App_Data/Media/ [ALL]   All of the media blobs. These files do not contain a file extension, so we use the double ** to explicitly include them in the .gitignore file.
/Website/App_Data/PageTemplates/ BaileyWeb.University.*.xml [ALL OTHERS] All project page templates.
/Website/App_Data/Razor/BaileyWeb [ALL]   All project Razor functions.
/Website/App_Data/Xslt/BaileyWeb [ALL]   All project XSLT functions.
/Website/App_GlobalResources/BaileyWeb/ [ALL]   All project localisation resources.
/Website/Frontend/ [ALL EXCEPT] /Website/Frontend/Composite/ This adds all of the AJAX related .ashx files, VisualEditor configuation files, images, JavaScripts, styles and libraries (Bootstrap, JQuery, etc.). It excludes anything related to my portfolio website, and the C1 CMS add-ons and components.
/Website/Frontend/Images/Portfolio/
/Website/Frontend/Orckestra/
/Website/Frontend/Sample/
/Website/Frontend/Scripts/Portfolio/
/Website/Frontend/Styles/Portfolio/
/Website/ favicon.ico [ALL OTHERS]  
favicon.png
/ [ROOT] .gitignore    
.gitattributes
BaileyWeb.University.License.txt
Mozilla.Public.License.txt
README.md

This list should include everything needed to get the University Package working on top of the C1 CMS.

The Resulting .gitignore File:

# BaileyWeb selective file and folder filter:
Website.sln

Website/*
Website/App_Code/*
Website/App_Data/*
Website/App_Data/Composite/*
Website/App_Data/Composite/DataMetaData/*
Website/App_Data/Composite/DataStores/*
Website/App_Data/Composite/InlineCSharpFunctions/*
Website/App_Data/Composite/TreeDefinitions/*
Website/App_Data/Media/*
Website/App_Data/PageTemplates/*
Website/App_Data/Razor/*
Website/App_Data/Xslt/*
Website/App_GlobalResources/*
Website/Frontend/Composite/
Website/Frontend/Images/Portfolio/
Website/Frontend/Orckestra/
Website/Frontend/Sample/
Website/Frontend/Scripts/Portfolio/
Website/Frontend/Static/
Website/Frontend/Styles/Portfolio/

!Website/App_Code/
!Website/App_Code/ExecuteC1FunctionHttpHandler.cs
!Website/App_Data/
!Website/App_Data/Composite/
!Website/App_Data/Composite/DataMetaData/
!Website/App_Data/Composite/DataMetaData/AcademicDepartments*.xml
!Website/App_Data/Composite/DataMetaData/AcademicYear*.xml
!Website/App_Data/Composite/DataMetaData/ApplicationMethod*.xml
!Website/App_Data/Composite/DataMetaData/AwardModes*.xml
!Website/App_Data/Composite/DataMetaData/Awards*.xml
!Website/App_Data/Composite/DataMetaData/Buildings*.xml
!Website/App_Data/Composite/DataMetaData/Campaigns*.xml
!Website/App_Data/Composite/DataMetaData/CampaignTypes*.xml
!Website/App_Data/Composite/DataMetaData/CaseStudies*.xml
!Website/App_Data/Composite/DataMetaData/Collections*.xml
!Website/App_Data/Composite/DataMetaData/Country*.xml
!Website/App_Data/Composite/DataMetaData/CountryDemo*.xml
!Website/App_Data/Composite/DataMetaData/CourseFeeBandCosts*.xml
!Website/App_Data/Composite/DataMetaData/CourseFeeBands*.xml
!Website/App_Data/Composite/DataMetaData/Courses*.xml
!Website/App_Data/Composite/DataMetaData/EducationLevels*.xml
!Website/App_Data/Composite/DataMetaData/EntryProfileQualifications*.xml
!Website/App_Data/Composite/DataMetaData/EntryProfiles*.xml
!Website/App_Data/Composite/DataMetaData/Events*.xml
!Website/App_Data/Composite/DataMetaData/Groups*.xml
!Website/App_Data/Composite/DataMetaData/GroupTypes*.xml
!Website/App_Data/Composite/DataMetaData/Honorifics*.xml
!Website/App_Data/Composite/DataMetaData/HonorificsDemo*.xml
!Website/App_Data/Composite/DataMetaData/LanguageRequirements*.xml
!Website/App_Data/Composite/DataMetaData/Locations*.xml
!Website/App_Data/Composite/DataMetaData/MainNavigation*.xml
!Website/App_Data/Composite/DataMetaData/ModuleFeeBandCosts*.xml
!Website/App_Data/Composite/DataMetaData/ModuleFeeBands*.xml
!Website/App_Data/Composite/DataMetaData/Modules*.xml
!Website/App_Data/Composite/DataMetaData/ModuleTypes*.xml
!Website/App_Data/Composite/DataMetaData/News*.xml
!Website/App_Data/Composite/DataMetaData/Organisation*.xml
!Website/App_Data/Composite/DataMetaData/Partners*.xml
!Website/App_Data/Composite/DataMetaData/PartnerTypes*.xml
!Website/App_Data/Composite/DataMetaData/People*.xml
!Website/App_Data/Composite/DataMetaData/Projects*.xml
!Website/App_Data/Composite/DataMetaData/ProjectStatus*.xml
!Website/App_Data/Composite/DataMetaData/Publications*.xml
!Website/App_Data/Composite/DataMetaData/QualificationTypes*.xml
!Website/App_Data/Composite/DataMetaData/SubjectFeeBandCosts*.xml
!Website/App_Data/Composite/DataMetaData/SubjectFeeBands*.xml
!Website/App_Data/Composite/DataMetaData/Subjects*.xml
!Website/App_Data/Composite/DataMetaData/Teams*.xml
!Website/App_Data/Composite/DataStores/
!Website/App_Data/Composite/DataStores/BaileyWeb.*.xml
!Website/App_Data/Composite/DataStores/Composite.Data.Types.IPage_*.xml
!Website/App_Data/Composite/DataStores/Composite.Data.Types.IPage_Unpublished_*.xml
!Website/App_Data/Composite/DataStores/Composite.Data.Types.IPageStructure.xml
!Website/App_Data/Composite/InlineCSharpFunctions/
!Website/App_Data/Composite/InlineCSharpFunctions/BaileyWeb.Data.*.cs
!Website/App_Data/Composite/InlineCSharpFunctions/BaileyWeb.University.*.cs
!Website/App_Data/Composite/TreeDefinitions/
!Website/App_Data/Composite/TreeDefinitions/BaileyWeb.University.*.xml
!Website/App_Data/Media/
!Website/App_Data/Media/**
!Website/App_Data/PageTemplates/
!Website/App_Data/PageTemplates/BaileyWeb.University.*.xml
!Website/App_Data/Razor/
!Website/App_Data/Razor/BaileyWeb
!Website/App_Data/Xslt/
!Website/App_Data/Xslt/BaileyWeb
!Website/App_GlobalResources/
!Website/App_GlobalResources/BaileyWeb/
!Website/Frontend/
!Website/favicon.ico
!Website/favicon.png

If you think I've missed something, please let me know in the comments below.


comments powered by Disqus