Top Banner
lightning talk
29

Git lighting talk

Jul 18, 2015

Download

Software

Caio Gondim
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Git lighting talk

lightning talk

Page 2: Git lighting talk

branches

Page 3: Git lighting talk

branches

• branch de desenvolvimento

• syncar código entre devs

dev

Page 4: Git lighting talk

branches

• branch de teste

• merge da dev

• teste para produção

• ambiente similar ao de produção

staging

Page 5: Git lighting talk

branches

• código de produção

• código homolagado em staging

• merge da staging

production

Page 6: Git lighting talk

branches

• feature que vai levar mais de um

commit

• algo que pode quebrar alguma

branch

• manter a sua bagunça separada

branch X

Page 7: Git lighting talk

branches

• $ git branch -a

listar branches

Page 8: Git lighting talk

branches

• $ git checkout --orphan

nova_branch

• branch sem pai

• bom para arquivos de suporte, design, ...

branch orfã

Page 9: Git lighting talk

log

Page 10: Git lighting talk

log

• $ git log --name-only

log do repositório

Page 11: Git lighting talk

log

• $ git log filename

log de um arquivo

Page 12: Git lighting talk

log

• $ git show commitID --name-only

detalhes de um commit

Page 13: Git lighting talk

blame

Page 14: Git lighting talk

blame

• $ git blame filename

• mostra quem inseriu cada linha

blame de arquivo

Page 15: Git lighting talk

blame

• $ git blame -L 10,20 filename

• limita entre as linhas 10 e 20

blame de arquivo entre linhas

Page 16: Git lighting talk

reverter mudanças

Page 17: Git lighting talk

reverter mudanças

• $ git clean -f

• deixa repositório idêntico ao último

commit

• deleta arquivos

limpar repositório

Page 18: Git lighting talk

reverter mudanças

• $ git checkout commitID

voltar para commit antigo

Page 19: Git lighting talk

commit messages

Page 20: Git lighting talk

commit messages

• resumo < 80 char

• nova linha

• descrição completa

• msg no presente perfeito

Boas práticas

Page 21: Git lighting talk

commit messages

• $ vi ~/.gitconfig

• [core] editor = subl -n -w

Sublime Text

Page 22: Git lighting talk

amend

Page 23: Git lighting talk

amend

• Altera último commit

• Para pequenos fixes

• Inserir arquivo esquecido

• Não gera um commit desnecessário

Mantendo o log limpo

Page 24: Git lighting talk

amend

• $ git commit --amend

• $ git push -f

Comandos

Page 25: Git lighting talk

conflitos

Page 26: Git lighting talk

conflitos

• Instale o Xcode pela Mac App Store

• $ git config --global merge.tool opendiff

• $ git config --global diff.tool opendiff

FileMerge no OS X

Page 27: Git lighting talk

conflitos

FileMerge no OS X

Page 28: Git lighting talk

atalhos