Last active
September 5, 2025 13:49
-
-
Save wdhowe/726bc72ce086ffeb041f08b4d5964eb6 to your computer and use it in GitHub Desktop.
bashrc/profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##-- PATH and Aliases --## | |
export PATH="/opt/homebrew/bin:/opt/homebrew/opt/openjdk/bin:$PATH:$HOME/bin" | |
alias ll='ls -l' | |
alias k='kubectl' | |
alias ke='kubectl exec -it' | |
alias kc='kubectx' | |
alias kn='kubens' | |
##-- Completions --## | |
# Installed via "brew install bash-completion" | |
[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh" | |
##-- General --## | |
function nth() { | |
# Get the nth line from the input. | |
# Usage: some_command | nth 3 | |
sed -n "${1}p" | |
} | |
##-- Git --## | |
# Installed via "brew install bash-git-prompt" | |
if [ -f "/opt/homebrew/opt/bash-git-prompt/share/gitprompt.sh" ]; then | |
__GIT_PROMPT_DIR="/opt/homebrew/opt/bash-git-prompt/share" | |
source "/opt/homebrew/opt/bash-git-prompt/share/gitprompt.sh" | |
fi | |
function git-rm-local-merged-branches() { | |
# Remove all local branches that have been merged into the current branch, except for main and master. | |
# list merged branches, exclude current branch, main, and master, then delete them. | |
git branch --merged | grep -v "^\*" | grep -v "main" | grep -v "master" | xargs git branch --delete | |
} | |
function git-clean() { | |
# Fetch latest changes and prune deleted branches, then remove local merged branches. | |
git fetch --prune | |
git-rm-local-merged-branches | |
} | |
function git-undo-last-commit() { | |
# Undo the last commit and unstage the changes. | |
git reset HEAD~1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment