Skip to content

Instantly share code, notes, and snippets.

@ywwwtseng
Created March 13, 2025 09:17
Show Gist options
  • Save ywwwtseng/2c235aa4d1073601eea3a99f322b0d95 to your computer and use it in GitHub Desktop.
Save ywwwtseng/2c235aa4d1073601eea3a99f322b0d95 to your computer and use it in GitHub Desktop.
sh-func.sh
del_all_branch () {
current_branch=$(git branch --show-current)
git branch | grep -Ev "^\s*(master|main|develop|dev|${current_branch})$" | xargs git branch -D
}
kill_port() {
if [ -z "$1" ]; then
echo "Usage: kill_port <port>"
return 1
fi
lsof -t -i tcp:$1 | xargs kill -9
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment