Skip to content

Instantly share code, notes, and snippets.

@jalama
Last active January 4, 2018 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jalama/4169120 to your computer and use it in GitHub Desktop.
Save jalama/4169120 to your computer and use it in GitHub Desktop.
Github aliases
[user]
name = Your Name
email = xxx@example.com
[core]
editor = vim
excludesfile = ~/.gitignore
filemode = false
symlinks = true
autocrlf = false
[merge]
tool = vimdiff
[color]
branch = auto
diff = auto
interactive = auto
status = auto
[alias]
st = status
ci = commit
co = checkout
# Switch to a branch, creating it if necessary
go = checkout -B
br = branch
unstage = reset HEAD --
last = log -1 HEAD
squash = rebase -i --autosquash HEAD~
graph = log --graph --abbrev-commit --pretty=oneline --decorate
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
# View the SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph
# create a patch from last commit
patch = diff HEAD~..
stash-unapply = !git stash show -p | git apply -R
# roll back last commit, will show files as modified...
undo = reset HEAD^
amend = commit --amend
# amend the last commit without editing the commit message
samend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
# remove deleted files using git rm
del = !git ls-files -z --deleted | xargs -0 git rm
# display the diff for modified files
mod = !git ls-files -z --modified | xargs -0 git diff
# Stage all modified files
addmod = !git ls-files -z --modified | xargs -0 git add
# add a file to the .gitignore file
ignore=!([ ! -e .gitignore ] && touch .gitignore) | echo $1 >>.gitignore
gitdiff = difftool --tool=vimdiff -U99999
# show list of files form latest commit
files = show --pretty="format:" --name-only
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
ignore = !git update-index --assume-unchanged
unignore = !git update-index --no-assume-unchanged
ignored = !git ls-files -v | grep ^[a-z]
stashdiff = !git stash show -p stash@{0}
# delete branches already committed into master
brclean = !git branch --merged | grep -v \"*\" | grep -v master | xargs -n 1 git branch -d
# Fancy Diff requires https://github.com/so-fancy/diff-so-fancy
dsf = "!f() { [ -z \"$GIT_PREFIX\" ] || cd \"$GIT_PREFIX\" && git diff --color \"$@\" | diff-so-fancy | less --tabs=4 -RFX; }; f"
# Rebuild master branch from origin
remaster = !git branch -D master && git fetch origin master && git checkout FETCH_HEAD && git co -b master
[color]
# Use colors in Git commands that are capable of colored output when outputting to the terminal
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
@jalama
Copy link
Author

jalama commented May 30, 2017

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