Skip to content

Instantly share code, notes, and snippets.

@nogsantos
Last active August 16, 2019 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nogsantos/c4dab809dfe95949aaf3bd9f683d2bdc to your computer and use it in GitHub Desktop.
Save nogsantos/c4dab809dfe95949aaf3bd9f683d2bdc to your computer and use it in GitHub Desktop.
Git config aliases
[alias]
# View status
st = status -sb
# Checkout
ck = checkout
# Update = pull
up = pull
# Create a new branch
nck = !git checkout -b $1 && :
# A more concise and readable git log
ls = log --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# Same as above, with files changed in each commit
ll = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --numstat
# Add all files and opens commitzen
set = !git add -A && git cz && :
# Update, rebase and publish
publish = !git checkout develop && git pull && git checkout $1 && git rebase develop && git push -u origin $1 && :
# Fetch and synchronize all brachs
sync = !git fetch --all --prune && git rebase -p --autostash $1 && :
# View a graph log
graph = log --graph
# Print the last commit title & hash
last = !git --no-pager log -1 --oneline --color
# Show which commits are safe to amend/rebase
unpushed = log @{u}..
# Show what you've done since yesterday to prepare your standup
standup = log --since yesterday --author $(git config user.email) --pretty=short
# Show the history difference between a local branche and its remote
divergence = log --left-right --graph --cherry-pick --oneline $1 origin/$1
# Quickly solve conflicts using an editor and then add the conflicted files
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; vim `f`"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add `f`"
# Show the last time each local branch changed
last-commits = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - (%(color:green)%(committerdate: relative)%(color:reset))'
[user]
email = user@email
name = User Name
[http]
sslVerify = false
[merge]
tool = meld
[mergetool "meld"]
# Choose one of these 2 lines (not both!) explained below.
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment