Fix bug #35.

I've fixed the bug and now `prepare` command works fine even if `TARGET_BRANCH` is defined.

An additional test is included for this fix, but unfortunately I wasn't able to try the real command on my machine because of the problem described in issue #41.