Introducao git fisl
-
Upload
hanneli-tavante -
Category
Documents
-
view
237 -
download
0
description
Transcript of Introducao git fisl
![Page 1: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/1.jpg)
Introdução ao Git(Por que não consigo mais usar SVN)
![Page 2: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/2.jpg)
Oi!Hanneli (a.k.a. @hannelita)!
Software developer!
Middleware Consultant at !
Café e Pokémon <3
![Page 3: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/3.jpg)
O que vamos ver hoje?Controle de versão - por que preciso disso?!
O surgimento do Git!
Primeiros passos com Git!
Para onde ir depois do básico!
Fotos e GIFS
![Page 4: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/4.jpg)
Yet another talk about Git?Tenho dificuldade para aprender.
Palestra com primeiros passos QUE FUNCIONAM, sem complicação.
![Page 5: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/5.jpg)
Seu primeiro dia numa empresa
![Page 6: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/6.jpg)
Seu primeiro dia numa empresa
Code Code Code
![Page 7: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/7.jpg)
Se o projeto já está andando, alguém precisa lhe fornecer o código
![Page 8: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/8.jpg)
Como obter o código?
![Page 9: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/9.jpg)
1. Pendrive?
![Page 10: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/10.jpg)
Pendrive?Rápido
#COMOFAZ
![Page 11: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/11.jpg)
SMP
![Page 12: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/12.jpg)
Sincronização Manual de Pendrives não parece legal.
![Page 13: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/13.jpg)
![Page 14: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/14.jpg)
2. Compartilhar pela rede
Projeto
![Page 15: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/15.jpg)
Compartilhar pela rede
![Page 16: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/16.jpg)
Compartilhar pela redeTodos com acesso ao código
![Page 17: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/17.jpg)
Compartilhar pela redeTodos com acesso ao código
LOL.java WTFWTF.java
LOL.java
#COMOFAZ
![Page 18: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/18.jpg)
Nenhum dos casos parece ser um bom cenário para distribuir e organizar o código numa equipe.
![Page 19: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/19.jpg)
Evolução nos repositórios de código
![Page 20: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/20.jpg)
Versão 3!Versão 2!Versão 1
SVN
![Page 21: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/21.jpg)
SVNAjuda com o Merge
Código Centralizado
Versionar de forma fácil e intuitiva
![Page 22: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/22.jpg)
Problem Solved!
![Page 23: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/23.jpg)
Problemas
• Conflitos
![Page 24: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/24.jpg)
Problemas• Como interromper a criação de uma tarefa e
começar outra?
![Page 25: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/25.jpg)
Problemas• Quero começar uma feature a partir de um código
que você ainda não comittou
![Page 26: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/26.jpg)
Problemas• A PASTA .svn CORROMPEU!
![Page 27: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/27.jpg)
Algo mais eficiente
![Page 28: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/28.jpg)
De volta a 2005
![Page 29: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/29.jpg)
Manter o Kernel!
![Page 30: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/30.jpg)
Manter o Kernel!
Versão 3!Versão 2!Versão 1
Controle de versão distribuído
![Page 31: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/31.jpg)
Git
![Page 32: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/32.jpg)
Quais suas primeiras impressões sobre Git?
• SVN é mais fácil!
• Git é muito complexo
• Não sei mexer nisso!
![Page 33: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/33.jpg)
Por que Git parece tão traumático?
![Page 34: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/34.jpg)
Por que Git parece tão traumático?
• Command Line
• Comandos são diferentes do SVN
• Novos conceitos
![Page 35: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/35.jpg)
Supere seus medos
![Page 36: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/36.jpg)
Git - primeiros passos1. Obter cópia local do
projeto
2. Receber alterações
3. Merge das alterações locais com remotas
4. Compartilhar alterações
git clone <URL do repo>
git pull
git add <FILE>!git commit -m “Commit"!
git push
git remote add remote_repo <URL repo>
![Page 37: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/37.jpg)
Acredite, isso já resolve muitos casos de uso.
![Page 38: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/38.jpg)
Git - e os conflitos?
![Page 39: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/39.jpg)
A Receita de Bolo para minimizar conflitos
• Faça suas alterações
• git checkout -b work
• git add <alterações>
• git commit -m "Alterações"
• git checkout master
• git pull
• git checkout work
• git rebase master
• git checkout master
• git merge work
• git push
![Page 40: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/40.jpg)
A Receita de Bolo para minimizar conflitos
![Page 41: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/41.jpg)
Explicando a receita
(programe, duh)
1. Faça suas alterações
![Page 42: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/42.jpg)
2. git checkout -b work
Explicando a receita
![Page 43: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/43.jpg)
O Git permite que você trabalhe em diferentes 'workspaces'
Explicando a receita
Projeto (cópia local)
git checkout -b
"Cópia" da cópia local
Posso alternar entre as "cópias"Uma “cópia" não é uma cópia em discoUma “cópia" é um snapshot
Branch
![Page 44: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/44.jpg)
BranchesExplicando a receita
Projeto (cópia local)
Branch master
git checkout -b workSnapshot
Branch workBaseado na branch master
git checkout -b lolol
SnapshotBranch lolol
Baseado na branch work
Cria nova branch
![Page 45: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/45.jpg)
Explicando a receita3. git add <alterações>
“Git, essas alterações são importantes! Quero que meu Snapshot as veja!"
4. git commit -m "Mensagem"
Meu snapshot local possui as alterações que quero enviar para o repositório remoto
![Page 46: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/46.jpg)
Explicando a receita5. git checkout master
branch work
git checkout
branch master
git checkout <nome Branch>
Alterna entre branches existentes
![Page 47: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/47.jpg)
Explicando a receita6. git pull
branch master
Pega as alterações do repositório remoto e faz merge
![Page 48: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/48.jpg)
Explicando a receitaOnde fizemos as alterações? Master ou work?
Se você não alterar o master, pode ter sempre uma cópia local do repositório atualizado sem ter conflitos!
![Page 49: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/49.jpg)
Explicando a receita7. git checkout work
branch master
git checkout
branch work
![Page 50: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/50.jpg)
Explicando a receita8. git rebase master
![Page 51: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/51.jpg)
Explicando a receitaExistem 2 formas para fazer merge no Git
git merge git rebaserebase possui vários usosOcorre ao fazer um git pull
"rebase faz um merge mais inteligente"
![Page 52: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/52.jpg)
Explicando a receitaPor que tive que trocar de branch para fazer rebase?
"rebase faz um merge mais inteligente"
Axioma
Só é seguro fazer rebase em branches locaisSe não criássemos outra branch, faríamos:
branch master
rebase
![Page 53: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/53.jpg)
Explicando a receita
![Page 54: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/54.jpg)
Explicando a receitaA chance de não ocorrer conflitos com rebase é maior do que
com git merge
"rebase faz um merge mais inteligente"
Só é seguro fazer rebase em branches locais
![Page 55: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/55.jpg)
Explicando a receita
Deixe os conflitos ocorrerem em sua snapshot de trabalho.
branch work
![Page 56: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/56.jpg)
Explicando a receita9. git checkout master
branch work
git checkout
branch master
![Page 57: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/57.jpg)
Explicando a receita10. git merge work
Se o rebase foi bem sucedido, o merge não terá problema
branch master
git rebase
branch work
Conflitos!ocorrem!
aqui
git merge
![Page 58: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/58.jpg)
Explicando a receita11. git push
Envia as alterações para o repositório remoto
branch master
![Page 59: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/59.jpg)
Complementando a receita11. git branch -d work
Remove a branch work. Nesse momento ela não é mais útil.Uma nova task, uma nova branch
![Page 60: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/60.jpg)
Onde posso conseguir um servidor Git?
Faça um ;D
Github
Bitbucket
![Page 61: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/61.jpg)
E aquela história de ‘controle de versão distribuído’?
git remote add server <URL>
server
git remote add Outro_server <URL2>
Outro_server
![Page 62: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/62.jpg)
Próximos passos de estudoBranches remotas
git stashgit resetgit revert
git bisect
git blame
Hooks git config
Ferramentas gráficas
![Page 63: Introducao git fisl](https://reader036.fdocumentos.tips/reader036/viewer/2022081720/54c3aad64a79591d428b45ed/html5/thumbnails/63.jpg)
Depois de um tempo com Git…
NÃO CONSIGO VOLTARA PARA O SVN!