Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created November 15, 2019 13:19
Show Gist options
  • Save diego3g/2b563e54e82bed5530d8346b89a701ab to your computer and use it in GitHub Desktop.
Save diego3g/2b563e54e82bed5530d8346b89a701ab to your computer and use it in GitHub Desktop.
[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
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})
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}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1
@wesllycode
Copy link

Show

@ribeiroevandro
Copy link

Irado man... Fiz um merge dos seus alias, com os meus... Ficou assim:

[alias]
    pom = push origin master -u
    ps = push
    ci = commit
    co = checkout
    cm = checkout master
    cb = checkout -b
    st = status -sb
    sf = show --name-only
    lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
    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})
    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}..)
    unstage = reset HEAD --
    undo = checkout --
    rollback = reset --soft HEAD~1

@felipeeleuterio
Copy link

Show de bola Diego!
Nesse contexto eu adicionei um elemento a mais para o git commit, para quando devemos passar uma mensagem junto ao comando.

_gitconfig

Com isso basta digitar git ci qualquer mensagem (isso mesmo! sem double quotes...) para agilizar e facilitar a nossa vida.

@brcaua
Copy link

brcaua commented Mar 30, 2020

Está ajudando e muito no desenvolvimento dos meus projetos. Obrigado!

@pcampina
Copy link

pcampina commented Apr 1, 2020

Mandou muitooo

@thadeu
Copy link

thadeu commented Apr 8, 2020

alias.psh=push origin HEAD # faz push de qualquer branch pegando pelo HEAD

alias.amend=commit -a --amend

alias.ahead=!sh -c 'echo branch is $(git fetch origin --quiet && git rev-list --count origin/master..HEAD) commits ahead, $(git fetch origin --quiet && git rev-list --count HEAD..origin/master) commits behind master'

Copy link

ghost commented Apr 10, 2020

@felipeeleuterio amei esse git ci description 💯 thankssss

@vicckm
Copy link

vicckm commented Apr 14, 2020

show, @felipeeleuterio! muito obrigada!!

@gufranco
Copy link

Todos os aliases que utilizo estão disponibilizados em https://github.com/gufranco/dotfiles/blob/master/git/.gitconfig. Acho que podem ser útil para quem deseja personalizar mais o Git :)

# Who am I? IT'S A ME, MARIO! :)
  me = config user.name

  # Less verbose status
  st = status -sb

  # Checkout
  co = checkout

  # Checkout master
  cm = checkout master

  # Checkout staging
  cs = checkout staging

  # Checkout development
  cd = checkout development

  # Push master
  pm = !(git push -u origin master)

  # 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)

@JaimeDevOne
Copy link

vlw @gufranco

@enzorossetto
Copy link

enzorossetto commented Apr 21, 2020

Gosto de utilizar esse alias também para mostrar uma árvore de commits com as branches e onde está o HEAD incluindo local e remoto
hist = log --oneline --graph --decorate --all

@wesleyMirand
Copy link

[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
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})
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}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1

@felmacs
Copy link

felmacs commented May 9, 2020

Muito bom!!!!

@ggbellotti
Copy link

Obrigado a todos pelas dicas! Minhas configurações ficaram assim 👇

.gitconfig

...

[core]
	editor = code --wait
	excludesfile = ~/.gitignore_global

[alias]
	ci = "!f() { git commit -m \"$*\"; }; f"
	pom = push -u origin master

.gitignore_global

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Dependency directories
node_modules/
jspm_packages/

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Optional npm cache directory
.npm

# TypeScript cache
*.tsbuildinfo

# dotenv environment variables file
.env
.env.test

# Next.js build output
.next
out

@RodolphoFernandes
Copy link

Ficou muito top o alias, eu particulamente desconhecia tudo isso.

@paulorochadev
Copy link

Muito Showw !

@Aledev21
Copy link

my alias
[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
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})
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}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1

@Vinicius7Dev
Copy link

Excelente! Facilitou muito, obrigado.

@MellonFive
Copy link

MellonFive commented Aug 13, 2020 via email

@yurimatheus
Copy link

Alguém já utilizou a possibilidade de ter os comandos unidos ao Git Flow? (https://danielkummer.github.io/git-flow-cheatsheet/index.pt_BR.html)

Acho essa ferramenta fantástica!

@felipealvessi
Copy link

felipealvessi commented Oct 22, 2020

No meu adicionei o pl para git pull

[alias]
pom = push origin master -u
ps = push
pl = pull
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
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})
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}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1

@Monique1929
Copy link

[core]
editor = "C:\Users\Monique\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait
[user]
name = eumoniqueevelyn@gmail.com
email = 66502970+Monique1929@users.noreply.github.com
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f

minhas configurações estão diferentes, é assim mesmo ou tenho que adicionar? Além do Alias é claro. / ps: já coloquei usuario e email na linha de comando.

@felipealvessi
Copy link

[core]
editor = "C:\Users\Monique\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait
[user]
name = eumoniqueevelyn@gmail.com
email = 66502970+Monique1929@users.noreply.github.com
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f

minhas configurações estão diferentes, é assim mesmo ou tenho que adicionar? Além do Alias é claro. / ps: já coloquei usuario e email na linha de comando.

Acredito que de cada pessoa deve está diferente mesmo. Adiciona as que você quer usar como alias.

exemplo do meu:

[alias]
pom = push origin master -u
ps = push
pl = pull
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
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})
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}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1

@eduardo-sdev
Copy link

Show!!

Copy link

ghost commented Mar 12, 2022

[core]
    editor = code
    whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
    pager = delta

[init]
    defaultBranch = main

[pull]
    rebase = false

[help]
    autocorrect = 1

[color]
    branch = auto
    diff = auto
    status = auto
    ui = auto

[alias]
    a = add --all
    cm = commit -m
    lg = log --graph
    st = status -sb
    br = branch
    psh = push -u
    sf = show --name-only

@RonanGil
Copy link

RonanGil commented Aug 18, 2022

Montei esses alias:

  • O primeiro para filtrar a consulta ao git log.
  • O segundo para quando utilizar o git rollback, poder refazer o commit aproveitando a mesma msg anterio.

exemplo: vamos fazer um git lg nos commits que realizaram um fix.
git lg-f fix

[alias]
  lg-f = "!f() { git log -2 --grep=\"$*\" --pretty=format:'%Cred%h%Creset %C(auto, yellow)%>(21,trunc)%ci%x08%x08%Creset %Cgreen<%an>%Creset %s%C(auto)%d' --graph --max-count=15; }; f"
  msgback = commit -C ORIG_HEAD

@als-guerra
Copy link

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

[core]
    editor = vim
    whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
    pager = delta

[init]
    defaultBranch = main

[pull]
    rebase = false

[help]
    autocorrect = 1

[alias]
  ci = commit
  co = checkout
  cm = checkout master
  cb = checkout -b
  st = status -sb
  sf = show --name-only
  lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
  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})
  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}..)
  unstage = reset HEAD --
  undo = checkout --
  rollback = reset --soft HEAD~1

[commit]
	gpgsign = true

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