Skip to content

Latest commit

History

History
52 lines (34 loc) 路 1.07 KB

bash-shortcuts.md

File metadata and controls

52 lines (34 loc) 路 1.07 KB

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.

#!/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.

#!/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