Quantcast
Channel: Uncategorized – Michael Freidgeim's Blog
Viewing all articles
Browse latest Browse all 11

FetchRemote function to work with git in Powershell

$
0
0

I have a useful method to create a remote git alias, if not exists,  and fetch data. I used it in Powershell scripts to operate with git remote branches:

function FetchRemote( $remoteAlias, $remoteRepository, $remoteBranch)
{
$aliasFound= & git remote | out-string -stream | select-string $remoteAlias
if([string]::IsNullOrEmpty($aliasFound))
{
git remote add -f -t $remoteBranch –no-tags $remoteAlias $remoteRepository
}
else
{
git fetch $remoteAlias
}
}


Viewing all articles
Browse latest Browse all 11

Trending Articles