Last active
March 14, 2019 05:46
-
-
Save MostafaNorzade/22bed2e4d2e5b6b499376d1d80151ce0 to your computer and use it in GitHub Desktop.
Bash Aliases Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## General Things | |
## ------------------- | |
alias ip="ipconfig getifaddr en0" | |
alias ipx="curl ipecho.net/plain; echo" | |
## Git Things | |
## ------------------- | |
## git status | |
alias gits="git status" | |
## normal branch creation | |
alias gitb="git checkout -b " | |
## push shortcut | |
function gpush() { | |
current=`git branch | grep \* | cut -d ' ' -f2` | |
git checkout dev | |
git pull | |
git checkout $current | |
git merge dev -m "merge branch dev into $current" | |
git push origin $current | |
} | |
## normal commit with a custom message | |
alias commit="git commit -m " | |
## stage all changes and commit with a custom message | |
alias commita="git add . && git commit -m " | |
## ammend all staged changes | |
alias amend="git commit --amend --no-edit" | |
## ammend all staged and unstaged changes | |
alias amenda="git add . && git commit --amend --no-edit" | |
## to delete all git branches, other than "master" and "dev" (might be unsafe, but works fine for me) | |
alias gdel="git branch | grep -v "master" | grep -v "dev" | xargs git branch -D" | |
## to discard unstaged changes, checkout "dev" branch and pull from the origin | |
alias gdev="git checkout . && git checkout dev && git pull" | |
## to do the above command and immediately make a branch | |
alias gb="gdev && git checkout -b " | |
## Laravel Things | |
## ------------------- | |
## php artisan | |
alias a="php artisan" | |
alias art="php artisan" | |
## tinker | |
alias tinker="php artisan tinker" | |
alias t="php artisan tinker" | |
## run test | |
alias 'tt'='vendor/bin/phpunit' | |
## Special for YasnaCMS Contributers | |
## --------------------- | |
alias 'list'='php artisan yasna:list' | |
alias 'list-'='php artisan yasna:list -a' | |
## to open github on the provided issue number | |
function hub() { | |
open "https://github.com/mhrezaei/yasna-core/issues/$1" | |
} | |
## to change database and quickly init the project | |
function db() { | |
if [ "$1" != "" ]; then | |
./env DB_DATABASE "$1"; | |
./i | |
else | |
./env DB_DATABASE; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment