Skip to main content

Overview

Aliases are defined in ~/.config/powershell/conf.d/20-aliases.ps1 and provide convenient shortcuts for frequently used commands.

Git Aliases

Common Git operations shortened to 2-3 characters:
AliasCommandDescription
ggitGit base command
gsgit statusShow working tree status
gagit addAdd files to staging
gaagit add --allStage all changes
gcgit commitCreate a commit
gcmgit commit -mCommit with message
gpgit pushPush to remote
gplgit pullPull from remote
gdgit diffShow unstaged changes
gdsgit diff --stagedShow staged changes
gcogit checkoutSwitch branches/restore files
gbgit branchList/manage branches
glgit log --oneline --graphPretty log graph
gstgit stashStash changes
gstpgit stash popApply stashed changes

Usage Examples

Git workflow with aliases
# Check status
gs

# Stage and commit
gaa
gcm "Add new feature"

# Push to remote
gp

# View commit history
gl

# Create and switch to new branch
gb feature/new-thing
gco feature/new-thing

Implementation

Source: 20-aliases.ps1
if (Get-Command git -ErrorAction SilentlyContinue) {
    function g { git $args }
    function gs { git status $args }
    function ga { git add $args }
    function gaa { git add --all $args }
    function gc { git commit $args }
    function gcm { git commit -m $args }
    function gp { git push $args }
    function gpl { git pull $args }
    function gd { git diff $args }
    function gds { git diff --staged $args }
    function gco { git checkout $args }
    function gb { git branch $args }
    function gl { git log --oneline --graph $args }
    function gst { git stash $args }
    function gstp { git stash pop $args }
}

Lazygit

Quick access to the lazygit TUI:
lg  # Opens lazygit in current repository
Source: 20-aliases.ps1
if (Get-Command lazygit -ErrorAction SilentlyContinue) {
    Set-Alias -Name lg -Value lazygit
}

HTTPie Aliases

HTTP method shortcuts for API testing:
AliasCommandDescription
hgethttp GETHTTP GET request
hposthttp POSTHTTP POST request
hputhttp PUTHTTP PUT request
hdelhttp DELETEHTTP DELETE request

Usage Examples

API testing with HTTPie
# GET request
hget https://api.example.com/users

# POST with JSON data
hpost https://api.example.com/users name=John email=john@example.com

# PUT with authentication
hput https://api.example.com/users/123 Authorization:"Bearer token" status=active

# DELETE request
hdel https://api.example.com/users/123

Implementation

Source: 20-aliases.ps1
if (Get-Command http -ErrorAction SilentlyContinue) {
    function hget { http GET $args }
    function hpost { http POST $args }
    function hput { http PUT $args }
    function hdel { http DELETE $args }
}

System Monitor Aliases

Use btop as the default system monitor:
top   # Opens btop
htop  # Opens btop (for Linux muscle memory)
Source: 20-aliases.ps1
if (Get-Command btop -ErrorAction SilentlyContinue) {
    Set-Alias -Name top -Value btop -Option AllScope
    Set-Alias -Name htop -Value btop -Option AllScope
}

Common Utility Aliases

which

Find command locations (PowerShell equivalent):
which git
# Output: C:\Program Files\Git\cmd\git.exe
Source: 20-aliases.ps1
Set-Alias -Name which -Value Get-Command

touch

Create empty files (Unix-style):
touch newfile.txt
touch app.js styles.css README.md
Source: 20-aliases.ps1
function touch { 
    param([string]$Path) 
    New-Item -ItemType File -Path $Path -Force | Out-Null 
}

Modern Tool Integrations

While defined in 30-tools.ps1, these aliases are worth noting:

bat (cat replacement)

cat file.txt  # Uses bat with syntax highlighting

eza (ls replacement)

CommandDescription
lsList files with icons
llLong format with git status
laLong format including hidden files
ltTree view (2 levels)
ltaTree view including hidden files

zoxide (cd replacement)

cd projects  # Uses zoxide for smart directory jumping

Conditional Loading

All aliases check for tool availability before creation:
Pattern used throughout
if (Get-Command <tool> -ErrorAction SilentlyContinue) {
    # Define aliases/functions
}
This ensures:
  • No errors if a tool isn’t installed
  • Profile loads successfully on any machine
  • Easy to see which tools are available

See Also

Build docs developers (and LLMs) love