Skip to content

Instantly share code, notes, and snippets.

@h1bay1
h1bay1 / TheFullMonty.ps1
Created April 23, 2018 21:23
The Final Product
Import-Module PSSlack
$checkoutPath = 'C:\Temp'
$repoUri = 'https://github.com/githubtraining/hellogitworld.git'
$repoFolder = 'hellogitworld'
$branchMatch = '*'
$defaultBranch = 'master'
$pushChanges = $false
$success = ":check2:"
$failed = ":x-cross:"
$mergeText = "*Merge Successful*"
@h1bay1
h1bay1 / PickUpTheSlack.ps1
Created April 23, 2018 21:22
Reporting the changes
Import-Module PSSlack
$success = ":check2:"
$failed = ":x-cross:"
$mergeText = "*Merge Successful*"
$conflictsText = "*Found Conflicts*"
$slackApiKey = '12345'
$slackChannel = '#testchannel'
$branchMatch = "feature/*"
$resultList = @{
"feature/brancha" = $success
@h1bay1
h1bay1 / TheGitStuff.ps1
Last active May 3, 2019 21:12
List, Iterate, Checkout, Pull, Push
$repoPath = "C:\Temp\hellogitworld"
Push-Location
Set-Location $repoPath
$branchMatch = '*'
$defaultBranch = 'master'
$pushChanges = $false
$resultList = @{}
$branches = git for-each-ref --format='%(refname:short)' refs/remotes/origin
foreach($branch in $branches){
$branchName = $branch.Substring(7, $branch.Length - 7)
@h1bay1
h1bay1 / Clone.ps1
Created April 23, 2018 21:18
Cloning the repo
$repoUri = "https://github.com/githubtraining/hellogitworld"
$repoFolder = "hellogitworld"
$checkoutPath = "C:\Temp"
Push-Location
if(!(Test-Path -Path $checkoutPath)){
New-Item -ItemType directory -Path $checkoutPath
}
Set-Location $checkoutPath
if(!(Test-Path -Path “$checkoutPath\$repoFolder”)){
Write-Host(“Cloning $repoUri into $checkoutPath\$repoFolder”)