Terminal Aliases for Flutter & Git

Terminal Aliases for Flutter & Git

Β·

2 min read

Some maybe more so than others, but typically as developers we use our terminals frequently to complete tasks. Sometimes these tasks have the exact same set of steps, other times the order might of steps might change.

If the commands and their order don’t change, writing a script can save you a lot of time. If the commands used are mostly the same but the order could be different based on the situation, then you could make use of aliases.

Shortening git status to gst might not seem like much of a win, but it shortens your time-to-completion, reduces the energy you need to put in, and the decrease in characters minimises the surface area for mis-typing. The real power though comes from stacking the gains from aliasing your most used commands.

Feel free to check out my personal config repository to see my up-to-date list of aliases and other such scripts.

Without further ado:

# Flutter
alias fv='flutter --version'
alias fd='flutter doctor'
alias fpg='flutter pub get'
alias ff='dart format .'
alias fa='flutter analyze'
alias fcl='flutter clean'
alias fcg='flutter pub run build_runner build --delete-conflicting-outputs'

# Flutter Wrapper
alias fwv='./flutterw --version'
alias fwd='./flutterw doctor'
alias fwpg='./flutterw pub get'
alias fwf='.flutter/bin/dart format .'
alias fwa='./flutterw analyze'
alias fwcl='./flutterw clean'
alias fwcg='.flutter/bin/dart pub run build_runner build --delete-conflicting-outputs'

# Melos
alias fmbs='flutter pub run melos bs'
alias fmf='flutter pub run melos format'
alias fma='flutter pub run melos analyze'
alias fmcg='flutter pub run melos codegen'

# Melos + Wrapper
alias fwmbs='.flutter/bin/dart pub run melos bs'
alias fwmf='.flutter/bin/dart pub run melos format'
alias fwma='.flutter/bin/dart pub run melos analyze'
alias fwmcg='.flutter/bin/dart pub run melos codegen'

# Git
alias gst='git status'
alias gd='git diff'
alias ga='git add'
alias gaa='git add --all'
alias gc='git commit --verbose'
alias gcm='git commit --message'
alias gcam='git commit --all --message'
alias gb='git branch'
alias gcl='git clone --recurse-submodules'
alias gco='git checkout'
alias gcb='git checkout -b'
alias gf='git fetch'
alias grpo='git remote prune origin'
alias gpull='git pull'
alias gpush='git push'
alias ggf='git push --force'
alias ggfl='git push --force-with-lease'
alias grh='git reset'
alias grhh='git reset --hard'
alias gl='git log'
alias gcp='git cherry-pick'
alias grv='git revert'
alias gstash='git stash push -m'
alias gspop='git stash pop'

Did you find this article valuable?

Support Idiomatic Bytes by becoming a sponsor. Any amount is appreciated!

Β