Skip to content

Instantly share code, notes, and snippets.

@kreig303
Last active April 26, 2024 03:05
Show Gist options
  • Save kreig303/9df209f8f7434d0a3c32607ea0b43d05 to your computer and use it in GitHub Desktop.
Save kreig303/9df209f8f7434d0a3c32607ea0b43d05 to your computer and use it in GitHub Desktop.
Powershell aliases for git and npm
##
# POWERSHELL SPECIFIC
##
Set-Alias clr clear # slight contraction of clear command
function brc { Start notepad "C:\Users\kzimmerman012\Documents\PowerShell\profile.ps1" } # for editing this file
function Reload-PowerShell { Start-Process pwsh; exit } # reload PowerShell Core
Set-Alias relo Reload-PowerShell
function lw { dir | fw } # wide listing
function up { cd .. } # better back
function rmraf { Remove-Item -Recurse -Force $args[0] }
##
# GIT SPECIFIC
##
function gpull { git pull }
function gpush { git push }
function gfetch { git fetch }
function gfull { git fetch ; git pull }
function gbase { git rebase }
function gtag { git tag }
function gs { git status } # regular view
function gss { git status -sb } # simple view
function gb { git branch }
function gch { git checkout $args[0] }
function gcb { git checkout -b $args[0] }
function gadd { git add } # add selection
function gadda { git add . } # add all
function gaddp { git add -p } # patch add
function gco { git commit -m $args[0] }
function gres { git reset }
function gresh { git reset --hard }
function gd { git diff }
function gds { git diff --stat }
# function gl { git log }
function glot { git log --pretty=format:'%h - %ar: %s' } # fancy git log
function glo { git log --oneline --decorate } # shortened
function gstash { git stash save }
function gpop { git stash pop }
function gbra { git branch }
function gbrav { git branch -vv } # very verbose
function gbrad { git branch -D $args[0] } # force delete
function grev { git remote -v } # list remotes
function gconfl { git config --global -l } # list global config
##
# NPM SPECIFIC
##
function nunpm { npm i npm@latest -g } # to install the latest and greatest npm
function npmclr { rm -rf node_modules/ package-lock.json } # to clean up a node app for reinstallation
function npmlg { npm ls -g --depth=0 } # list all globally installed packages
##
# POSH-GIT SPECIFIC
##
ipmo posh-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment