Skip to content

Instantly share code, notes, and snippets.

@vejandla
Last active January 6, 2022 17:34
Show Gist options
  • Save vejandla/0be8b297f49f871ce482d9d38a3756fb to your computer and use it in GitHub Desktop.
Save vejandla/0be8b297f49f871ce482d9d38a3756fb to your computer and use it in GitHub Desktop.
powershell aliases for git.
# add it in the default profile \Users\{username}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# https://stackoverflow.com/a/41862274/2043920
# https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx
# Remove Defaults
rename-item alias:\gc gk -force
rename-item alias:\gcm gkm -force
rename-item alias:\gl gll -force
rename-item alias:\gsn gsnn -force
rename-item alias:\gm gmm -force
# Git
function git-status { git status }
Set-Alias -Name s -Value git-status
function git-addall { git add -A }
Set-Alias -Name gaa -Value git-addall
function git-branch { git branch $args }
Set-Alias -Name gb -Value git-branch
function git-diff { git diff $args }
Set-Alias -Name gd -Value git-diff
function git-diff-cached { git diff --cached }
Set-Alias -Name gdc -Value git-diff-cached
function git-diff-master { git diff master }
Set-Alias -Name gdm -Value git-diff-master
function git-diff-develop { git diff develop }
Set-Alias -Name gdd -Value git-diff-develop
function git-commit-all { git commit -a }
Set-Alias -Name gca -Value git-commit-all
function git-commit-m { git commit -m $args }
Set-Alias -Name gcm -Value git-commit-m
function git-checkout { git checkout $args }
Set-Alias -Name gco -Value git-checkout
function git-log { git log }
Set-Alias -Name gl -Value git-log
function git-fetch { git fetch }
Set-Alias -Name gf -Value git-fetch
function git-rebase-continue { git rebase --continue }
Set-Alias -Name grc -Value git-rebase-continue
# Misc
function back-one-dir { cd .. }
Set-Alias -Name .. -Value back-one-dir
function back-two-dir { cd ..\.. }
Set-Alias -Name ... -Value back-two-dir
function back-three-dir { cd ..\..\.. }
Set-Alias -Name .... -Value back-three-dir
function back-four-dir { cd ..\..\..\.. }
Set-Alias -Name ..... -Value back-four-dir
function go-to-tfs-client-app { cd C:\work-tfs\<app>\ClientApp }
Set-Alias -Name t-client-app -Value go-to-tfs-client-app
function go-to-git-client-app { cd C:\work-git\<app>ClientApp }
Set-Alias -Name g-client-app -Value go-to-git-client-app
# Set-Theme Paradox
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme Agnoster
# Set-PoshPrompt -Theme Paradox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment