Skip to content

Instantly share code, notes, and snippets.

@svenluijten
Last active June 22, 2017 11:35
Show Gist options
  • Save svenluijten/f3b2d52223f66264587b39216679a404 to your computer and use it in GitHub Desktop.
Save svenluijten/f3b2d52223f66264587b39216679a404 to your computer and use it in GitHub Desktop.
Handy bash functions I commonly use

"dotfiles"

A collection of my "dotfiles" on Windows. I use this in combination with Cmder with a git bash shell.

# Start the SSH agent and add all ed25519 and rsa keys.
function agent() {
eval `ssh-agent -s`
if [ -f ~/.ssh/*_ed25519 ]; then
ssh-add ~/.ssh/*_ed25519
fi
if [ -f ~/.ssh/*_rsa ]; then
ssh-add ~/.ssh/*_rsa
fi
}
# Filesystem traversal
alias e.="explorer.exe ."
alias ll="ls -lah"
alias ..="cd .."
alias home="cd ~"
# PHP development
alias a="php artisan $*"
alias cdu="composer dump autoload"
alias test="./vendor/bin/phpunit $*"
alias tef="./vendor/bin/phpunit --filter $*"
# General utility
alias s.="subl ."
# Reload the dotfiles.
function fresh() {
( source ~/.bashrc && source ~/.profile )
}
[user]
name = John Doe
email = [email protected]
[alias]
st = status -sb
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
df = diff --
ap = add -p
ges = !git stash && git pull origin HEAD && git stash pop
find = log --pretty=\"format:%Cblue%H %Cgreen%s%Creset\" --abbrev-commit --grep
[branch]
autosetuprebase = always
[core]
autocrlf = true
excludesfile = '~/.gitignore'
[push]
default = current
[color]
ui = true
# Execute Homestead-related vagrant commands globally
function homestead() {
( cd ~/Homestead && vagrant $* )
}
# Remove stale git branches (branches that are not present on the remote)
function unstale() {
git fetch --prune
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do
git branch -D $branch;
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment