Skip to content

Instantly share code, notes, and snippets.

@clintonmedbery
Last active June 12, 2019 23:19
Show Gist options
  • Save clintonmedbery/a22dbc2fd354e3fdda2a5bd1960f7bb0 to your computer and use it in GitHub Desktop.
Save clintonmedbery/a22dbc2fd354e3fdda2a5bd1960f7bb0 to your computer and use it in GitHub Desktop.
Useful Bash Aliases
#Edit in vim
alias vimRc="vim ~/.zshrc"
alias vimHosts="sudo vim /private/etc/hosts"
#Edit Code
alias codeRc="code ~/.zshrc"
alias codeHosts="sudo code /private/etc/hosts"
#Source Terminal
alias sourceRc="source ~/.zshrc"
alias dockStopAll="docker stop $(docker ps -q)"
function jira () {
echo -e "Enter Jira Project Name:"
read name
echo -e "Enter Jira Ticket Number:"
read ticketid
URL="ceterus.atlassian.net/browse/$name-$ticketid"
echo "opening $URL"
open -a /Applications/Google\ Chrome.app https://$URL
}
function current-branch() {
git rev-parse --abbrev-ref HEAD
}
confirm() {
echo -e "Do you want to move forward? [y/n]"
read response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
echo "Aborting"
;;
esac
}
function addCommit () {
branch=$(current-branch)
echo "Commiting to Branch Name: $branch"
#Assumes jira number is 3 digits long
start="${branch:0:7}"
echo "Message Prefix: $start -"
echo -e "What is your message?"
read message
git add .
echo "Git Status:"
git status
echo "Going to commit with message:"
fullMessage="$start - $message"
echo $fullMessage
confirm && git add . && git commit -m "$message"
}
function pushb() {
git push origin $(current-branch)
}
function pullb() {
git pull origin $(current-branch)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment