File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ function Test-GitRemote {
2+ <#
3+ . SYNOPSIS
4+ Scans git directories and displays remotes information
5+
6+ . DESCRIPTION
7+ Scans git directories and displays git remotes information with verbose option.
8+ It provides following information:
9+
10+ origin git@github.com:alan-null/test.git (fetch)
11+ origin git@github.com:alan-null/test.git (fetch)
12+
13+ . PARAMETER DirectoryPath
14+ Root dir containing other git repo folders
15+
16+ . EXAMPLE
17+ Test-GitRemote
18+ Iterates through folders in a current directory and displays git status of each repo
19+
20+ . EXAMPLE
21+ Test-GitRemote c:\repo
22+ Iterates through folders from a 'c:\repo' directory and displays git status of each repo
23+ #>
24+
25+ [CmdletBinding ()]
26+ param (
27+ [Parameter (Mandatory = $false , Position = 0 )]
28+ [string ]$DirectoryPath
29+ )
30+
31+ # begin {
32+ # Import-Module posh-git
33+ # }
34+
35+ process {
36+ if (! $DirectoryPath ) {
37+ $DirectoryPath = Get-Location
38+ }
39+ $revertPath = Get-Location
40+
41+ try {
42+ Get-ChildItem $DirectoryPath | ? { $_.PSIsContainer } | % {
43+ $dir = $_.FullName
44+
45+ Set-Location $dir
46+ $git = Get-GitStatus
47+
48+ if ($git.GitDir ) {
49+ Write-Host $dir - ForegroundColor Green
50+ git remote - v
51+ Write-Host " "
52+ }
53+ }
54+ }
55+ finally {
56+ Set-Location $revertPath
57+ }
58+ }
59+ }
You can’t perform that action at this time.
0 commit comments