powerShell git 使用 以及循環本地目錄腳本
- git 安裝
- 配置git的環境變量----cmd :git --version
- 安裝NuGet 管理器—Install-PackageProvider NuGet -Force
- 引入NuGet管理器—Import-PackageProvider NuGet -Force
- 克隆posh-git 工程------ git clone https://github.com/dahlbyk/posh-git
- 安裝運行 posh----進入posh-git 目錄 運行.\install.ps1
- 編寫腳本
$sourcFolder = Get-Location
$folderList = Get-ChildItem -Name ccbscf-*
Foreach($folder in $folderList)
{
echo "---------------FETCH PORJECT NAME---------------$folder---------------"
cd $sourcFolder/$folder
git remote
git fetch --all
}
cd $sourcFolder