What are your most liked alias for long commands or just to give them better names.
Mine are:
alias load="source .load.sh"
alias eload="$EDITOR .load.sh"
alias gpush="git push"
alias gadd="git add --all"
alias gcommit="git commit -m "
alias gst="git status -s"
alias gpull="git pull"
alias ..='cd ..'
mkcd() { mkdir -p “$1” && cd “$1”; }
Make a directory and immediately cd into it. I rarely make a directory and not cd into it.
I found a function version of this version somewhere. Same thing except it defaults to my local area but can be overridden if you specify a different zip code.
weather() {
if [ $(command -v curl) ]; then
if ! (($#)); then
curl wttr.in/44113
else
curl wttr.in/$1
fi
else
echo "curl not installed. Aborting."
fi
}
alias ll=“ls - l”
My most-used, by far, for decades.
Not exactly an alias but a short script. First, get git-revise which is a replacement for git rebase
, and fzf if for some reason you don’t have it yet. Then make a script in your ~/.local/bin
called git-f
or whatever you’d like:
#!/bin/bash
REF=${1:-origin/main} # adjust to your favorite trunk branch name
COMMIT=$(git log --pretty=oneline ${REF}.. \
| fzf --preview "git show -p --stat {+1}" | cut -d' ' -f1)
if [ -n "$COMMIT" ]; then
exec git revise "$COMMIT"
else
exit 1
fi
Now hack away in a branch, make some commits, and at some point you will realize you want to modify an earlier commit. Use git add -p
to add the relevant lines, but then instead of making a fixup commit just type git f
and pick the target commit from the list.