Skip to content

Instantly share code, notes, and snippets.

@cristianp6
Created May 19, 2017 10:43
Show Gist options
  • Save cristianp6/fc4a58dfbfdc5c92f133355ca4bc40d9 to your computer and use it in GitHub Desktop.
Save cristianp6/fc4a58dfbfdc5c92f133355ca4bc40d9 to your computer and use it in GitHub Desktop.
My git config with handy custom aliases
[user]
name = Cris
email = cris@email.com
[alias]
# move into existing branch
co = checkout
# move into current development brach: change branch name
cod = checkout develop
# create new branch and move into it
cob = checkout -b
# push branch to remote
cop = "!git push -u origin"
# edit current config
ecc = config -e
# edit global config
ecg = config --global -e
# force update and submodules updates
up = !git pull $@ && git submodule update --init --recursive
# reset last commit
rl = reset HEAD^
# reset hard
rh = reset --hard
# sort status
s = status -s
# verbose status
ss = status
# stash save all
sts = stash save --include-untracked
# commit with message
c = !git commit -m
# commit all with message
cm = !git add -A && git commit -m
# undo last commit
undo = reset HEAD~1 --mixed
# change last commit message before push
amend = commit -a --amend
# cherry-pick a single commit by sha hast
cpc = cherry-pick
# show differences
d = diff
#
ds = diff --stat
# list branches sorted by last modified
lbs = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list local branches
lb = branch -a
# list local unmerged branches
lu = !git branch -r --no-merged | grep -v HEAD | xargs -L1 git --no-pager log --pretty=tformat:'%Cgreen%d%Creset - %h by %an (%Cblue%ar%Creset)' -1
# list tags
lt = tag -l
# list stash
ls = stash list
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
# log detailed list of my commits in the last 48 hours
lcd="log --since=2.days --author='Cris' --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# log list of my commits in the last 48 hours
lcl="log --since=2.days --author='Cris' --pretty=format:'- %s' --abbrev-commit"
# remove local branch
rb = branch -D
# remove remote branch
rbr = push --delete origin
# remove branch prune
rbp = fetch --prune
# Gitflow Feature Start
ffs = flow feature start
# Gitflow Feature Publish
ffp = flow feature publish
# Gitflow Feature Finish
fff = flow feature finish
# Gitflow Hotfix Start
fhs = flow hotfix start
# Gitflow Hotfix Finish
fhf = flow hotfix finish
# Gitflow Release Start
frs = flow release start
# Gitflow Release Publish
frp = flow release publish
# Gitflow Release Finish
frf = flow release finish
# Push tags on master and push to develop
ptm = "!git push --tags origin master && git push origin develop"
[push]
default = matching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment