why popd only if $branchName?