Implement analog for 'git checkout --branch xxx ...'
Add missing git_buf_free