Fill these in once
- Save the shortcut and load it
echo "alias gs='git status'" >> ~/.zshrc source ~/.zshrc
Check it worked
- Check what it runs
alias gs
Undo it
- Remove it
sed -i '' "/^alias gs=/d" ~/.zshrc && unalias gs
- Save the shortcut and load it
echo "alias gs='git status'" >> ~/.bashrc source ~/.bashrc
Check it worked
- Check what it runs
alias gs
Undo it
- Remove it
sed -i "/^alias gs=/d" ~/.bashrc && unalias gs
- Save the shortcut in your profile and load it
if (!(Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force } Add-Content $PROFILE "function gs { git status @args }" . $PROFILEPowerShell shortcuts that include arguments have to be small functions, which is what this adds.
Check it worked
- Check what it runs
Get-Command gs | Select-Object -ExpandProperty Definition
Undo it
- Remove it
(Get-Content $PROFILE) | Where-Object { $_ -notmatch '^function gs ' } | Set-Content $PROFILE