Tag Archives: git

Case Sensitivity on Git for Macs

Today I ran into an issue with git and case sensitivity on Macs. Although Macs preserve case, their filesystems is case insensitive. So something like:

themes/ODOC/odoc.info

is equivalent to:

themes/odoc/odoc.info

However, they are completely different when deployed to a linux server. Therefore it completely ignored any attempt to change the case and Drupal was actually using “themes/ODOC” instead of the correct “themes/odoc”. If you ever run into this issue, I found this blog entry to be extremely valuable:

http://tapestryjava.blogspot.com/2010/07/git-on-mac-os-x-dont-ignore-case.html

NetBeans Local History to the rescue

I did not realize the power of git reset. If you need to do a git reset on your working copy and you have modified (tracked, but uncommitted) changes, then git reset will blow away all your changes without warning.

To recover your changes:
If your IDE doesn’t do local backups, then your changes are lost forever. However, if you use NetBeans IDE, then you should have no problem recovering your lost changes. Ever since NetBeans version 6.x, by default it keeps 7 days work of file changes.

In order to view your file’s local history, make sure the file is open and click Team -> Local History -> Show Local History. NetBeans should give you a diff breakdown of your current file with previous teimd snapshots. Once you find the snapshot you want, right click the date and choose Revert from History.

Hope this helps!!

Git Logo

Accidentally Adding a Git Submodule

Git LogoRecently I’ve been working on a Drupal project at work and a fellow co-worker wanted to piggy-back resources on a similar project. He sent me over the code for a custom module I was going to use on the project.

Only after committing and pushing the folder from my local git repo to the origin server did I notice the remnants of my co-workers .git folder. This cause git to treat the subfolder as a git submodule and ignore the contents of the subfolder as I push my project to the origin server.

Here is what you need to do in order to remove the submodule and add as a subfolder:

git rm --cached subfolder
git add subfolder
git commit -m "Enter message here"
git push

Now the origin should be able to see the contents of the subfolder.