create the branch before checkout

For fixing this message "You are in 'detached HEAD' state", I think it's better to create the branch