How to Create a New and Empty Branch in Git

git checkout --orphan NEWBRANCH
git rm -rf .
touch .gitignore
git commit -a -m ""

Via bitflop.

Addendum: 2014-02-28:

Create an orhan branch
git checkout --orphan lp
git rm -rf .
touch .gitignore
git add .gitignore
git diff --cached
git commit -m "Initial import."
Create a remote branch
git push -u origin lp
Obtain a remote branch
git checkout -b lp
Delete a branch
Remote: git push origin :lp
Local: git branch -D lp

Pro Git Book Review

As a Subversion master-user I was hoping for a lot from \_Pro Git and was rewarded greatly. The author gives Git a fair shake without throwing Subversion under the bus. He does a great job teaching not just the tools, but the culture and “how to think” the Git way. The latter is devoid in literally every tutorial I’ve seen online, and I’m not sure it is even possible to sum it up in anything less than the entirety of this book. The length is just fine, chapter are brief, terse, light, and information packed. The multitude of tools and approaches revealed in the book make it worth reading, and buying, too. Although the book is free online, the author should be rewarded with a purchase. Before reading this I spent 5 months using Git with the typical docs: man pages,, and random posts. This book pulled everything together, it was kind of like sitting with a hacker who really groks it all (as you will see in the last chapter), and that alone is priceless. 5/5

Addendum: the formatting and graphics in the Kindle version look excellent (forgot to mention this key point as not all Kindle books look this great).

Setting up QBZR on OS X

Bzr is nice to use. It is tailored for the masses (of which I am a member). It has the usual UNIX support, but it has first-class Windows support, too. It has a nice UI if you want it. The community is great, too.

A few days ago I installed it on OS X and found that there was no UI support via Qt. Fortunately there are directions for setting it up here. Here are the steps that I followed:

  1. Installed bzr 1.14.1
  2. Installed Qt for Mac OS X Cocoa, qt-mac-cocoa-opensource-4.5.1.dmg, to the default location
  3. Verified its installation by running ’qtdemo’
  4. Installed sip, sip-4.7.9.tar.gz
  5. Installed PyQt, PyQt-mac-gpl-4.4.4.tar.gz (build took a relatively long time)
  6. Tried out qlog and qdiff and they worked fine

Now I am wondering if I should have just installed this using MacPorts.

Addendum: 06/21/09

Here are the directions that I followed from that link:

In order to install PyQt, you need to have SIP installed.
1) download and install QT4.x
2) get SIP from
$> python -d /Library/Python/2.5/site-packages
$> make
$> sudo make install
3) get PyQT from
$> python -q /bin/qmake -d /Library/Python/2.5/site-packages
$> make
$> sudo make install
Hope this helps to get qbzr working

BZR as of today works with Python 2.4 or greater. Leopard comes with both 2.3 and 2.5 installed; but defaults to 2.5.

I didn’t know where qmake was installed; and typing ’type -a qmake’ seemed to be the quickest way to find it.

Uninstall Subversive

Although Subversive is the official Eclipse Subversion provider, the plugin itself doesn’t behave very well. In particular, it is impossible to uninstall it (v0.7) using the “Software Updates” dialog. The only option is to delete the jar files yourself (in 2001 I remember hoping that soon, we wouldn’t have to do stuff like this). Here are the files to delete:

(Disclaimer: this worked for me, I make no promises for what it might do to your Eclipse installation)

Remove .svn files recursively

Today I needed to convert a Subversion working copy (aka a checkout) into an export. Recursively blowing away all of the .svn directories in DOS (Windows XP) didn’t seem to be straightforward so I ended up using UNIX find in cygwin. Here is the command:

find . -type d -name '.svn' -exec rm -rf {} \;

The command was provided here, and the following is documentation from the man page.

  • find :: Execute the find command
  • . :: Path in which to start
  • -type d :: File is of type ’d’, a directory.
  • -name ’.svn’ :: The file name on which to match, .svn.
  • -exec rm -rf {} \; :: Execute this command for every file that is found. The string ’{}’ is replaced by the current file name being processed. The semi-colon is escaped by a backslash. While reading the man page, I also found that you probably should enclose the braces in single quote marks.