Bash Workflow Shortcuts
Bash scripts I use to make my life easier.
Vercel Deploy
Open Vercel deploy page with the current git repo as the source.
vc.sh
#!/bin/bash
REMOTE=`git remote show -n origin | grep Push | cut -d: -f2- | rev | cut -c 5- | rev `
LINK="https://vercel.com/new/import?s=$REMOTE"
CLEAN_LINK=`echo $LINK | sed 's/ //g'`
# If there is remote, else echo
if [ -n "$REMOTE" ]; then
open $CLEAN_LINK
else
echo "No remote found"
fi
Checkout Main and Delete
Checkout to the main branch and delete the previous branch.
main-and-delete-branch.sh
#!/bin/bash
# Checkout to main branch
# Then delete the branch
branch=$(git branch | grep \* | cut -d ' ' -f2)
git checkout main
git pull
if [ $branch != "main" ]; then
git branch -D $branch
fi
# add to zsh
# alias gcmr="bash /Users/Clarence/flow/main-and-delete-branch.sh"
Git Emergency
Save your current changes and push them to a remote branch.
Code in GitHub (opens in a new tab)
Last updated on February 12, 2023