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:

  • A .project file -- this is par for the course in Eclipse
  • A .settings folder
  • And a settings.xml file

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.

in Apple | CFBuilder | Git Posted 2010-07-06 12:46

4 responses:

m@
m@ 2010-07-07 6:46 AM #
can you recommend a good setup tutorial for GIT for coldfusion development?
preferably one with an eclipse plugin like egit
Adam
Adam 2010-07-07 9:01 AM #
Well m@, there is a lot of variance. I tend to use Git mostly on my Mac, where the command line client is awesome, and I can get a little visual feedback with GitX. I do have Egit installed in CFBuilder, but tend to only use it for comparing different revisions and instead stick to doing the core functions via command line. It sounds cliché, but once you know how to work with the command line client, it's typically faster and easier to use that than any GUI client. Add Visor < http://visor.binaryage.com/ > into the mix and My hands never have to leave the keyboard.

Every now and then I try to setup Git on Windows and while it works, it still feels clunky to me. For that reason, I tend to just use Egit in CFBuilder when I'm on Windows.

I'm not sure what you're looking for in a setup tutorial. Can you be more specific in your question?
m@
m@ 2010-07-07 10:12 AM #
I had a brief search around last weekend and found a lot on Git, I looked at eGit and it had some info that its for jGIT or some GIT for Java, I'm not to familiar with GIT so I'm not sure exactly how many GITs there are and which GIT I should use, is jGIT (think that was the name) the best?
and is it the only one eGIT connects to?
thanks
Adam
Adam 2010-07-07 10:36 AM #
Egit < http://www.eclipse.org/egit/ > is an Eclipse Team provider for the Git version control system (aka a Git client that integrates with the Eclipse IDE).

Jgit < http://www.eclipse.org/jgit/ > is a java library for interacting with Git; and is used by Egit.

If you want to integrate a Git client into your Eclipse installation, install Egit.

Just as with other source control system (e.g. Subversion) you still need a repository to work with, in addition to the client.

That's about the limit of how far I want to discuss getting started with Git here. If you still need to know more, I would suggest you seek out tutorials on getting started with Git, of which there are many available at Github: http://help.github.com/

Leave a comment:

Leave this field empty: