Skip to content

Instantly share code, notes, and snippets.

@Shawn1224
Created January 29, 2021 03:30
Show Gist options
  • Save Shawn1224/45c726f4c5bc1d9a9b178c0234b38762 to your computer and use it in GitHub Desktop.
Save Shawn1224/45c726f4c5bc1d9a9b178c0234b38762 to your computer and use it in GitHub Desktop.
Set an alias command to quickly delete git branch completely.
  1. Create a shell file
touch ~/del_branch.sh
  1. Put below into the file
#!/bin/bash
echo "exec $0"
set -x

branch_name = $1
git branch -D $1
git push --delete origin $1
  1. Append below into ~/.bash_profile
# shortcut
alias del_branch="~/del_branch.sh"
chmod u+r+x $del_branch
  1. Activation
source ~/.bash_profile

🙌Alright, all set, give it a shot🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment