Skip to content

Instantly share code, notes, and snippets.

@markusfalk
Last active September 30, 2018 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markusfalk/c8dce10a3d28c49a8e58 to your computer and use it in GitHub Desktop.
Save markusfalk/c8dce10a3d28c49a8e58 to your computer and use it in GitHub Desktop.
.bash_aliases
#terminal
alias c='clear'
alias la='ls -alFAG'
alias pro='cd ~/Projects && pwd && la'
#docker
alias dps='docker ps'
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
#node
alias npmibasics='npm i -g npx'
alias npmls='npm ls --depth=0'
alias npmu='for package in `ls node_modules`; do npm uninstall $package; done;' # uninstall all
#maven
# bump version in pom.xml
bumpVersion() {
red=`tput setaf 1`
reset=`tput sgr0`
if [ -z "$1" ]
then
echo "Please provide ${red}versioner number${reset} as ${red}first argument${reset}"
else
mvn release:update-versions -DautoVersionSubmodules=true --batch-mode -DdevelopmentVersion=$1
fi
}
alias bumpversion='bumpVersion'
# pop a stash with given index
popStash() {
red=`tput setaf 1`
reset=`tput sgr0`
if [ -z "$1" ]
then
echo "Please provide ${red}stash index${reset} as ${red}first argument${reset}"
else
git stash pop stash@{$1}
fi
}
# delete branch locally and remotely
removeBranch() {
red=`tput setaf 1`
reset=`tput sgr0`
if [ -z "$1" ]
then
echo "Please provide ${red}branch name${reset} as ${red}first argument${reset}"
else
git branch -d $1 && git push origin :$1
fi
}
# for a specific commit, show changed files only
showChangeFilesForCommit() {
red=`tput setaf 1`
reset=`tput sgr0`
if [ -z "$1" ]
then
echo "Please provide ${red}commit ID${reset} as ${red}first argument${reset}"
else
git diff-tree --no-commit-id --name-only -r $1
fi
}
alias add='git add'
alias amend='git commit --amend'
alias checkout='git checkout'
alias contains='git branch --contains'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='removeBranch'
alias gc='git commit'
alias gd='git diff'
alias gl='git log --pretty=oneline --abbrev-commit'
alias glf='showChangeFilesForCommit'
alias glm='gl --author="Markus Falk"'
alias gs='git status'
alias gsl='git stash list'
alias gss='git stash save'
alias gti='git' #reminder: GTI = fun; GIT = work!
alias merge='git merge'
alias merged='git branch --merged'
alias notmerged='git branch --no-merged'
alias pop='popStash'
alias prune='git remote prune origin'
alias pull='git pull'
alias push='git push'
alias show='git show'
alias sync='git pull && echo --- && git push'
# Network
# show all process listening to a specific branch
portsInUse() {
red=`tput setaf 1`
reset=`tput sgr0`
if [ -z "$1" ]
then
echo "Please provide ${red}port number${reset} as ${red}first argument${reset} and I will tell you what apps are using it :)"
else
lsof -n -i:$1 | grep LISTEN
fi
}
alias port='portsInUse' # port 8080
# Chrome debug mode
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &'
@markusfalk
Copy link
Author

.bash_profile:

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases; fi

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