Git para quem gosta de git

  • View
    1.246

  • Download
    1

  • Category

    Software

Preview:

DESCRIPTION

Workshop apresentado na uMov.me sobre GIT. Básico e avançado. História, exemplos, commits, branchs, merges, remote, stash, bisect, apply, diff, reset, tagging, etc.

Citation preview

Git para quem gosta de gitou não

Eduardo Bohrerhttp://about.me/nbluis

História

Kernel em números

9 repositórios oficiais com suporte ativo

Kernel em números

★ 17+ milhões de linhas de código★ 9700+ desenvolvedores (desde o inicio do

git)★ 200+ empresas envolvidas atualmente★ Média de 9 commits por hora

http://www.cnet.com/news/linux-development-by-the-numbers-big-and-getting-bigger/http://royal.pingdom.com/2012/04/16/linux-kernel-development-numbers/

Eu prefiro um tallball

SVN Slogan = CSV Done Right

Um dia de fúria de Linux Torvalds

There is no way to do cvs right. (Linus Torvalds)

Trabalho remoto, independente, offline

SSL

Rápido

Compressão

Histórico local

Branchs locais

Tags locais

Working tree local

Commits locais

Github

Chega de mimimi

Um commit no GIT

Pasta raiz

Sub-pasta

Arquivo no raiz

Arquivo na sub-pasta

Um commit no GIT

git commit

Um commit no GITcommit: c1---------------------parent: nulltree: Pasta raizauthor: Bohrer

tree: Pasta Raiz-----------------------------tree: Sub-pastablob: Arquivo no Raiz

blob: Arquivo no Raiz

tree: bcdblob: Arquivo na sub-pasta

tree: Sub-pasta-------------------------------------blob: Arquivo na sub-pasta

Outro commit

Mudei um arquivogit commit

Outro commitcommit: c2---------------------parent: c1tree: Pasta raizauthor: Bohrer

tree: Pasta Raiz-----------------------------tree: Sub-pastablob: Arquivo no Raiz

blob: Arquivo no Raiz

commit: c1---------------------parent: nulltree: Pasta raizauthor: Bohrer

tree: Pasta Raiz-----------------------------tree: Sub-pastablob: Arquivo no Raiz

blob: Arquivo no Raiz

tree: bcdblob: Arquivo na sub-pasta

tree: Sub-pasta-------------------------------------blob: Arquivo na sub-pasta

Working tree

c1master* c2 c3 c4 c5

Forks e Branches

master* c2 c3 c4 c5

work c2 c3 c4 c5

b2 c4 c5

c1

Uma linda e maravilhosa arvore!

Mas o SVN também faz

Esqueça o que aprendeu sobre VCS

Branchs são legaisMerges também (as vezes)

Fork e branch

git branch workgit checkout work

Fork e Branch

master c1

work*

c2

Fork e Branch

master c2

work* c3 c4

c1

Merge

Estrategias de merge

● Fast forward● Recursive● Octopus● Outros (mais complexos)

Merge

git checkout mastergit merge work

Fast forward

master* c2

work c3 c4

c1Não há nada a resolver! :)

Fast forward

c2

master*work c3 c4

c1Não há nada a resolver! :)

Recursive merge

master c2 c3

work c3 c4

c1 c4 Commit nas duas. :(

Recursive merge

master* c2 c3

work c3 c4

c1 c4 c5

Octopus merge

master* c2

c5

work c2 c3

b2 c4

c1

Octopus merge

master* c2

c5

work c2 c3

b2 c4

c1 c5

Mas o SVN também faz

Podando a árvore

git rebase

Git rebase

master c2

work* c3 c4

c1

Git rebase

master

c2

work*

c3 c4c1

Mais ferramentas

Muito mais

Git remote

git remoteSó mais um ramo

Git remote

origin/master c2

master* c3 c4

c1

Git pull

git pull(git fetch + git merge)

Git push

git push origin master

Git log

git log

Git stash

git stashgit stash apply

Git patch + apply

git format-patchgit apply

Git bisect

git bisect startgit bisect endgit bisect run

Git bisect

c2 c3 c4 c5c1 c5

GOOD BAD

Git bisect

c2 c3 c4 c5c1 c5

GOOD BADBAD

Git bisect

c2 c3 c4 c5c1 c5

GOOD BAD

Git bisect

c2 c3 c4 c5c1 c5

BADGOODGOOD

Git bisect

c2 c3 c4 c5c1 c5

BADGOOD

Git bisect

c2 c3 c4 c5c1 c5

Primeira versão com problema

Git diff

git diffgit diff origin master

dif diff a --not b

Git reset

git resetgit reset --hard

Git tag

Tagging done right!

Aprendendo mais

http://pcottle.github.io/learnGitBranching

Ferramentas gráficas

Eu prefiro SVN

Me dê APENAS 1 motivo

Git para quem gosta de gitou não

Eduardo Bohrerhttp://about.me/nbluis

Recommended