Skip to content

Instantly share code, notes, and snippets.

@dflima
Last active August 20, 2018 19:22
Show Gist options
  • Save dflima/28e83d68bfb39622d4a98c86dfc03166 to your computer and use it in GitHub Desktop.
Save dflima/28e83d68bfb39622d4a98c86dfc03166 to your computer and use it in GitHub Desktop.
[alias]
foo="!f() { echo "begin arg=$1/$2/end"; }; f"
# Short for status
st = status
# View the current working tree status using short format
s = status -s
# Get current branch
cu = "!git branch | grep '\\*' | cut -d ' ' -f 2"
# Rename local and remote branches, and push to origin. $1 = old_branch_name, $2 = new_branch_name
rename="!f() { git branch "$2" origin/"$1" && git push origin --set-upstream "$2" && git push origin --delete "$1"; }; f"
# Checkout and merge. $1 = master (or any other you like)
come="!f() { CU=`git cu`; git checkout "$1" && git pull -p && git checkout $CU && git merge "$1" --no-ff; }; f"
# Color graph log view
graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
# Switch to a branch, creating if necessary.
go = "!f() { git checkout -b "$1" 2> /dev/null || git checkout "$1"; }; f"
# Delete branches already merged with master
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d; git remote -v update -p"
# List contributors with number of commits
contributors = shortlog --summary --numbered
[push]
default = matching
[pull]
rebase = true
[core]
autocrlf = false
fileMode = false
[gui]
encoding = utf-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment