Public/Authoral/Import-Repository.ps1

function Import-Repository {
    param(
        [parameter(ValueFromPipelineByPropertyName)]$Repos
    )
    process {
        $Repos | ForEach-Object {
            $Folder = $_
            if ($($(Test-Path -Path $(Resolve-Path -Path $Folder.Parent)) -eq $True)) {
                Set-Location $Folder.Parent
                $repos = $($Folder.repos | ConvertFrom-Json)
                $repos | ForEach-Object {
                    clone -Alias $_.alias -Folder $Folder -Path $_.repo
                    if ($_.branches) {
                        $_.branches  | ForEach-Object {
                            git checkout $_
                            git pull --set-upstream origin $_
                        }
                    }
                    git push -u origin --all
                }
            }
            else {
                New-Item -Type Directory $Folder.Parent
                Set-Location $Folder.Parent
                $repos = $($Folder.repos | ConvertFrom-Json)
                $repos | ForEach-Object {
                    clone -Alias $_.alias -Folder $Folder -Path $_.repo
                    if ($_.branches) {
                        $_.branches  | ForEach-Object {
                            git checkout $_
                            git pull --set-upstream origin $_
                        }
                    }
                    git push -u origin --all
                }
            }
        }
    }
}