Skip to content

Commit a9aaaf1

Browse files
authored
Merge branch 'master' into patch-1
2 parents b8a7351 + c6b99b7 commit a9aaaf1

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

src/aliases.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ function gb {
3131
function gba {
3232
git branch -a $args
3333
}
34+
function gbd {
35+
git branch -d $args
36+
}
3437
function gbda {
3538
$MainBranch = Get-Git-MainBranch
3639
$MergedBranchs = $(git branch --merged | Select-String "^(\*|\s*($MainBranch|develop|dev)\s*$)" -NotMatch).Line
@@ -133,6 +136,9 @@ function gcs {
133136
function gd {
134137
git diff $args
135138
}
139+
function gds {
140+
git diff --staged $args
141+
}
136142
function gdca {
137143
git diff --cached $args
138144
}
@@ -254,10 +260,19 @@ function gpoat {
254260
git push origin --all
255261
git push origin --tags
256262
}
263+
function gpr {
264+
git pull --rebase $args
265+
}
266+
function gpra {
267+
git pull --rebase --autostash $args
268+
}
257269
function gpristine {
258270
git reset --hard
259271
git clean -dfx
260272
}
273+
function gprv {
274+
git pull --rebase -v $args
275+
}
261276
function gpu {
262277
git push upstream $args
263278
}
@@ -299,12 +314,20 @@ function grhh {
299314
function grmv {
300315
git remote rename $args
301316
}
317+
function groh {
318+
$CurrentBranch = Get-Git-CurrentBranch
319+
320+
git reset origin/$CurrentBranch --hard
321+
}
302322
function grrm {
303323
git remote remove $args
304324
}
305325
function grs {
306326
git restore $args
307327
}
328+
function grst {
329+
git restore --staged $args
330+
}
308331
function grset {
309332
git remote set-url $args
310333
}
@@ -388,9 +411,15 @@ function gunwip {
388411
git reset HEAD~1
389412
}
390413
function gup {
414+
Write-Host-Deprecated "gup" "gpr"
391415
git pull --rebase $args
392416
}
417+
function gupa {
418+
Write-Host-Deprecated "gupa" "gpra"
419+
git pull --rebase --autostash $args
420+
}
393421
function gupv {
422+
Write-Host-Deprecated "gupv" "gprv"
394423
git pull --rebase -v $args
395424
}
396425
function glum {
@@ -419,3 +448,11 @@ function ggp {
419448

420449
git push origin $CurrentBranch
421450
}
451+
function ggpnp {
452+
ggl; ggp $args
453+
}
454+
function gprom {
455+
$MainBranch = Get-Git-MainBranch
456+
457+
git pull --rebase origin $MainBranch $args
458+
}

src/git-aliases.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'git-aliases.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.3.5'
15+
ModuleVersion = '0.3.6'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

src/git-aliases.psm1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $FunctionsToExport = @(
1111
'gau',
1212
'gb',
1313
'gba',
14+
'gbd',
1415
'gbda',
1516
'gbl',
1617
'gbnm',
@@ -42,6 +43,7 @@ $FunctionsToExport = @(
4243
'gcpc',
4344
'gcs',
4445
'gd',
46+
'gds',
4547
'gdca',
4648
'gdt',
4749
'gdw',
@@ -78,7 +80,10 @@ $FunctionsToExport = @(
7880
'gpf',
7981
'gpf!',
8082
'gpoat',
83+
'gpr',
84+
'gpra',
8185
'gpristine',
86+
'gprv',
8287
'gpu',
8388
'gpv',
8489
'gr',
@@ -92,9 +97,11 @@ $FunctionsToExport = @(
9297
'grh',
9398
'grhh',
9499
'grmv',
100+
'groh',
95101
'grrm',
96102
'grset',
97103
'grs',
104+
'grst',
98105
'grt',
99106
'gru',
100107
'grup',
@@ -120,13 +127,16 @@ $FunctionsToExport = @(
120127
'gunignore',
121128
'gunwip',
122129
'gup',
130+
'gupa',
123131
'gupv',
124132
'glum',
125133
'gvt',
126134
'gwch',
127135
'gwip',
128136
'ggl',
129-
'ggp'
137+
'ggp',
138+
'ggpnp',
139+
'gprom'
130140
)
131141

132142
Export-ModuleMember -Function $FunctionsToExport

src/utils.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,26 @@ function Get-Git-Aliases ([string] $Alias) {
133133

134134
return Format-Table -InputObject $aliases -AutoSize -Wrap -Property $cols
135135
}
136+
137+
<#
138+
.SYNOPSIS
139+
Print deprecated message.
140+
.DESCRIPTION
141+
Print a colored message telling that a specific alias ($previous)
142+
is deprecated, suggesting the use of another alias ($next).
143+
.EXAMPLE
144+
PS C:\> Write-Host-Deprecated "gup" "gpr"
145+
[git-aliases] gup is a deprecated alias, use "gpr" instead.
146+
#>
147+
function Write-Host-Deprecated {
148+
param (
149+
[Parameter(Mandatory = $true)][string] $previous,
150+
[Parameter(Mandatory = $true)][string] $next
151+
)
152+
153+
Write-Host "[git-aliases] " -ForegroundColor Yellow -NoNewLine
154+
Write-Host "${previous}" -ForegroundColor Red -NoNewLine
155+
Write-Host " is a deprecated alias, use " -ForegroundColor Yellow -NoNewLine
156+
Write-Host """${next}""" -ForegroundColor Green -NoNewLine
157+
Write-Host " instead.`n" -ForegroundColor Yellow
158+
}

0 commit comments

Comments
 (0)