Skip to content

Instantly share code, notes, and snippets.

@tsur
Last active April 4, 2016 20:49
Show Gist options
  • Save tsur/1c0c377c944448c4f829 to your computer and use it in GitHub Desktop.
Save tsur/1c0c377c944448c4f829 to your computer and use it in GitHub Desktop.
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
# Add to bash_profile
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Create a ~/.gitconfig file containing
[diff]
tool = meld
[merge]
tool = meld
[user]
name =
email =
[alias]
co = checkout
ci = commit
unstage = reset HEAD --
last = log -1 HEAD
visual = !gitk
lastc = log -1 --pretty=format:\"%h -> %s\"
st = status
meow = status
br = branch
br-history = for-each-ref --sort=-comitterdate refs/heads/ --format='%(HEAD)%(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(comitterdate:relative)%(color:reset))'
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
clean-merged-remote = git branch --merged unstable | grep -v "\*" | xargs -n 1 git push origin --delete
clean-merged-local = git branch --merged unstable | grep -v "\*" | xargs -n 1 git branch -D
find = "!git ls-files | grep -i"
finda = "!grepalias() { git config --global --get-regexp alias | grep -i \"$1\" | awk -v nr=2 '{sub(/^alias\\./,\"\")};{printf \"\\033[31m%_10s\\033[1;37m\", $1};{sep=FS};{for (x=nr; x<=NF; x++) {printf \"%s%s\", sep, $x; }; print \"\\033[0;39m\"}'; }; grepalias"
[push]
default = matching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment