Quick dirty way to clean git history

Sometimes my git history got messed up due to some strange issues. I use the following quick/dirty way to create a clean new branch.
Step 1: use the “git clone” command to clone the master branch to a separate new folder
Step 2: rsync the changed content of your old branch to the new folder excluding the .git subfolder
rsync -avz --exclude .git old-folder/ new-folder
Step 3: create a new branch out of the new folder and then push
$ cd new-folder
$ git checkout -b my-new-branch

Lastly, we can avoid lots of hassles if using “git pull –rebase” instead of the simple “git pull” command.

Xdebug waiting for connection problem in Netbeans

Just got my new Mac air, and spent hours setting up xdebug to work with the latest Netbeans 7.3.1 on OS X 10.8.4 . I have set up Xdebug on various systems before, including Linux (CentOS, Ubuntu), Windows (XAMPP), and Mac OS, and almost always have issues here and there. This time is no strange either. Netbeans always displays “waiting for connection” every time I clicked the debug button in Netbeans.

The “netstat -nat | grep 9000” command shows port 9000 was connected/disconnected successfully in each try, so it seems that connection was established just fine.

Then I spent hours of time checking firewall setup and playing with all sorts of php.ini parameters. And eventually, I changed the port to 9001 in both php.ini and the Netbeans debugger, and bum it works magically! Sigh.