-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.ps1
More file actions
46 lines (39 loc) · 1.31 KB
/
profile.ps1
File metadata and controls
46 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Import-Module posh-git
Import-Module Go
. "$PSScriptRoot\Scripts\Invoke-ElevatedCommand.ps1"
Set-Alias iec Invoke-ElevatedCommand
function Reset-Git {
$target = ''
if ($args){
$target = "origin/$args"
}
else {
$current = (&git rev-parse --abbrev-ref HEAD)
$target = "origin/$current"
}
Write-Host "Performing fetch and hard reset to $target..."
$headBefore = (&git rev-parse HEAD)
& git fetch -p;git reset --hard $target
$headAfter = (&git rev-parse HEAD)
Write-Host "...done."
Write-Host
Write-Host "HEAD before: $headBefore"
Write-Host "HEAD after: $headAfter"
}
function Find-GitLocalMerged {
Write-Host "git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'}}"
& git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'}
}
function Clean-GitLocalMerged {
Write-Host "git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}"
& git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}
}
function Help-Me {
Write-Host "My Custom Functions"
Write-Host "==================="
Write-Host " Invoke-ElevatedCommand (iec)"
Write-Host " Reset-Git"
Write-Host " Find-GitLocalMerged"
Write-Host " Clean-GitLocalMerged"
Write-Host
}