Skip to content

Instantly share code, notes, and snippets.

@Rofram
Last active April 26, 2022 22:32
Show Gist options
  • Save Rofram/74dac2e13ffb34c4050ddfd9c0161578 to your computer and use it in GitHub Desktop.
Save Rofram/74dac2e13ffb34c4050ddfd9c0161578 to your computer and use it in GitHub Desktop.
my git config global
[user]
name = Rodrigo de França
email = [email protected]
[init]
defaultBranch = main
[core]
editor = code --wait
[github]
user = Rofram
# [url "[email protected]:"]
# insteadOf = https://github.com/
[color]
ui = auto
[color "status"]
added = green
changed = yellow
untracked = red
[color "branch"]
current = magenta
local = yellow
remote = green
[color "diff"]
meta = yellow
frag = magenta
old = red
new = green
[pull]
rebase = true
[branch]
autosetuprebase = always
[rerere]
enabled = true
[push]
default = current
[help]
autocorrect = 1
[alias]
# Who am I? IT'S A ME, MARIO! :)
me = config user.name
# Less verbose status
st = status -sb
# short command commit
c = "!f() { git commit -m \"$*\"; }; f"
# add all files and commit
ca = "!f() { git add --all && git commit -m \"$*\"; }; f"
# Checkout
co = checkout
# Checkout main
cm = checkout main
# Checkout staging
cs = checkout staging
# Checkout development
cd = checkout development
# edit git config global
cfg = config --global --edit
# Push main
pm = !(git push -u origin main)
# Push staging
ps = !(git push -u origin staging)
# Push development
pd = !(git push -u origin development)
# Syncronize local branchs with remote
fe = fetch origin
# Fork a branch
fork = checkout -b
# Complete pull (with submodules)
pull-sub = !(git pull && git submodule foreach git pull origin master)
# Pretty log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# Remote commits ahead of mine
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
# Remote commits ahead of local
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)
# The missing command <3
unstage = reset HEAD --
# Undo modifications to a file
undo = checkout --
# Last 24 hours commits
standup = !(git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --since yesterday --author "$(git me)")
# Review commits before pushing
ready = rebase -i @{u}
# Branchs hier
hier = log --all --graph --decorate --oneline --simplify-by-decoration
# Create a package
package = !(GZIP=-9 tar --exclude=".git/" -zcvf ../$(basename "$PWD")_$(date +"%Y-%m-%d_%H-%M-%S").tar.gz *)
# Resolve conflict using ours
resolve-ours = !(grep -lr '<<<<<<<' . | xargs git checkout --ours)
# Resolve conflict using theirs
resolve-theirs = !(grep -lr '<<<<<<<' . | xargs git checkout --theirs)
# List committers
committers = !(git log | grep Author | sort | uniq -c | sort -n -r)
# add remote repository
rmo = remote add origin
# mandatory commit
mco = commit -m "Initial commit"
# amend commit (no message)
amc = commit --amend --no-edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment