Git

Ignoring directories with Git.

Tuesday, January 27th, 2009

Ignoring directories in git was a concept hard for me to grasp. The gitignore help file didn’t help me all that much.

If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in git).

This never worked for me. The only way I could get it to work was to use something like “directory/*” in my .gitignore file. I could also just use “directory”, but that would match any file and directory with that name. It would also look for other matches further down the tree recursively.

So in summary to hide the build directory use:

build/*

Posted in Git | No Comments »

A note on using git for web development.

Monday, December 22nd, 2008

Let’s start with some background information, the site I was working on was a typical wordpress blog running with wp-super-cache and hosted on a slice. I usually develop on my local server with git. I then push the site to my slice.

The trouble came when I decided to revert my code back to a previous instance, and after reviewing my site, I pushed the updates to my slice and turned on wp-super-cache. But after a few hours I noticed my site was continually going offline. Even though it never affected any of the other sites I hosted on that server.

The problem was that git doesn’t remember file permissions and I forgot to tell git to ignore the cache folder. So when I reverted back to a different version it also reverted the cache folder, its contents, and proceeded to change the permissions to what I assume was the default permissions when I first initiated the repository. So not being able to write to the cache folder made wp-super-cache crash the apache process and eventually all the apache processes took all the memory. 

So when using git don’t forget to reset your permissions, when reverting back to an earlier instance of code.

Posted in Coding, Git | No Comments »