Detect which branch to fetch.