Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
gluons authored Dec 31, 2024
2 parents b8a7351 + c6b99b7 commit a9aaaf1
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
37 changes: 37 additions & 0 deletions src/aliases.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function gb {
function gba {
git branch -a $args
}
function gbd {
git branch -d $args
}
function gbda {
$MainBranch = Get-Git-MainBranch
$MergedBranchs = $(git branch --merged | Select-String "^(\*|\s*($MainBranch|develop|dev)\s*$)" -NotMatch).Line
Expand Down Expand Up @@ -133,6 +136,9 @@ function gcs {
function gd {
git diff $args
}
function gds {
git diff --staged $args
}
function gdca {
git diff --cached $args
}
Expand Down Expand Up @@ -254,10 +260,19 @@ function gpoat {
git push origin --all
git push origin --tags
}
function gpr {
git pull --rebase $args
}
function gpra {
git pull --rebase --autostash $args
}
function gpristine {
git reset --hard
git clean -dfx
}
function gprv {
git pull --rebase -v $args
}
function gpu {
git push upstream $args
}
Expand Down Expand Up @@ -299,12 +314,20 @@ function grhh {
function grmv {
git remote rename $args
}
function groh {
$CurrentBranch = Get-Git-CurrentBranch

git reset origin/$CurrentBranch --hard
}
function grrm {
git remote remove $args
}
function grs {
git restore $args
}
function grst {
git restore --staged $args
}
function grset {
git remote set-url $args
}
Expand Down Expand Up @@ -388,9 +411,15 @@ function gunwip {
git reset HEAD~1
}
function gup {
Write-Host-Deprecated "gup" "gpr"
git pull --rebase $args
}
function gupa {
Write-Host-Deprecated "gupa" "gpra"
git pull --rebase --autostash $args
}
function gupv {
Write-Host-Deprecated "gupv" "gprv"
git pull --rebase -v $args
}
function glum {
Expand Down Expand Up @@ -419,3 +448,11 @@ function ggp {

git push origin $CurrentBranch
}
function ggpnp {
ggl; ggp $args
}
function gprom {
$MainBranch = Get-Git-MainBranch

git pull --rebase origin $MainBranch $args
}
2 changes: 1 addition & 1 deletion src/git-aliases.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'git-aliases.psm1'

# Version number of this module.
ModuleVersion = '0.3.5'
ModuleVersion = '0.3.6'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
12 changes: 11 additions & 1 deletion src/git-aliases.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $FunctionsToExport = @(
'gau',
'gb',
'gba',
'gbd',
'gbda',
'gbl',
'gbnm',
Expand Down Expand Up @@ -42,6 +43,7 @@ $FunctionsToExport = @(
'gcpc',
'gcs',
'gd',
'gds',
'gdca',
'gdt',
'gdw',
Expand Down Expand Up @@ -78,7 +80,10 @@ $FunctionsToExport = @(
'gpf',
'gpf!',
'gpoat',
'gpr',
'gpra',
'gpristine',
'gprv',
'gpu',
'gpv',
'gr',
Expand All @@ -92,9 +97,11 @@ $FunctionsToExport = @(
'grh',
'grhh',
'grmv',
'groh',
'grrm',
'grset',
'grs',
'grst',
'grt',
'gru',
'grup',
Expand All @@ -120,13 +127,16 @@ $FunctionsToExport = @(
'gunignore',
'gunwip',
'gup',
'gupa',
'gupv',
'glum',
'gvt',
'gwch',
'gwip',
'ggl',
'ggp'
'ggp',
'ggpnp',
'gprom'
)

Export-ModuleMember -Function $FunctionsToExport
23 changes: 23 additions & 0 deletions src/utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,26 @@ function Get-Git-Aliases ([string] $Alias) {

return Format-Table -InputObject $aliases -AutoSize -Wrap -Property $cols
}

<#
.SYNOPSIS
Print deprecated message.
.DESCRIPTION
Print a colored message telling that a specific alias ($previous)
is deprecated, suggesting the use of another alias ($next).
.EXAMPLE
PS C:\> Write-Host-Deprecated "gup" "gpr"
[git-aliases] gup is a deprecated alias, use "gpr" instead.
#>
function Write-Host-Deprecated {
param (
[Parameter(Mandatory = $true)][string] $previous,
[Parameter(Mandatory = $true)][string] $next
)

Write-Host "[git-aliases] " -ForegroundColor Yellow -NoNewLine
Write-Host "${previous}" -ForegroundColor Red -NoNewLine
Write-Host " is a deprecated alias, use " -ForegroundColor Yellow -NoNewLine
Write-Host """${next}""" -ForegroundColor Green -NoNewLine
Write-Host " instead.`n" -ForegroundColor Yellow
}

0 comments on commit a9aaaf1

Please sign in to comment.