fusiongrokker

Easily Ignore CFBuilder Meta Files in a new Git Repo

When you create a new ColdFusion project in CFBuilder, you end up with 3 things in your project folder:

During the pre-release process I voiced my opinion that this was too much meta and that they should find a way to cut back or combine where possible. That hasn't happened. In addition, I complained that the file name "settings.xml" is too generic and quite likely to be something that the average developer would want to create for their project. This, too, seems to have fallen on deaf ears.

Oh well. Maybe next time.

However, in the meantime, I've created a quick shortcut for my Mac to create a new git repository and ignore all of the CFB Project Meta files all in one step. On Snow Leopard, edit the .profile file in your account folder (/Users/[your username]/.profile) and add this line:

alias cfgit="git init;echo '.project' >> .gitignore;echo '.settings' >> .gitignore;echo 'settings.xml' >> .gitignore;echo '.gitignore' >> .gitignore;git status"

It all has to be on one line to work properly, but I'll break down each command individually here so that it's easier to read.

alias cfgit="..."

Here we're creating a bash command alias. This translates to, "When I type cfgit I want you to do [this] instead." Where [this] is what you put inside the quotation marks. You can put multiple commands here as long as you separate them with a semicolon.

echo '.project' >> .gitignore;
echo '.settings' >> .gitignore;
echo 'settings.xml' >> .gitignore;
echo '.gitignore' >> .gitignore;

Each of these appends a new line to the file .gitignore with the contents of the single-quotation marks; so in this case it's adding a new line for .project, .settings, settings.xml, and .gitignore (ignore itself). By using >> instead of >, you append to the file if it exists, or create it otherwise. If you're unaware, the .gitignore file tells the local git client which files in the folder are to be excluded from the repository.

Lastly, it runs git status to show the current status of the folder/repository; mostly just as a sanity check to make sure that everything that I want to have happened has.

Posted in Apple | CFBuilder | Git | 4 Responses  

4 responses:





Leave this field empty: