SlideShare a Scribd company logo
Sendo ágil com
w w w. l a m b d a 3 . c o m . b r
Giovanni Bassi
• Programador
• Microsoft MVP
• Não gerente
• blog.lambda3.com.br, podcast.lambda3.com.br,
nodebr, dockersp
@giovannibassi
/giggio.tech
• Escalador e ciclista
Sendo ágil com git
Podcast
podcast.lambda3.com.br
Sendo ágil com git
vagas.lambda3.com.br
Agenda
Sendo ágil com git
Clone, commit,
push
Clone
93230c5
master HEAD
= commit
= branch
= HEAD
origin/
master
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
4ebf653
Push
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
4ebf653
Checkout branch
Branch
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
outro
HEAD
Checkout
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
outro HEAD
Merge, checkout,
merge
Trabalho no branch “outro” terminado
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
HEADoutro
Merge master
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
HEAD
outrod4545ea
Checkout master
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
outrod4545ea
HEAD
Merge outro
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
outrod4545ea
HEAD
Demo
Tudo são arquivos
Progredindo com
Clone
93230c5
master HEAD
= commit
= branch
= HEAD
origin/
master
Add
93230c5
= commit
= branch
= HEAD
origin/
master
master HEAD
Staging
/Index
Staging/IndexStaging/Index
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
Commit
93230c5 0ac78b6
= commit
= branch
= HEAD
origin/
master
master HEAD
7f3ddf
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
7f3ddf
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
7f3ddf 7bdf1a
Clean code
Clean commit
Squash
Commit
93230c5 0ac78b6
master HEAD
= commit
= branch
= HEAD
origin/
master
7f3ddf 7bdf1a
Mensagens
93230c5 0ac78b6 7f3ddf 7bdf1a
Mensagens
93230c5 0ac78b6 7f3ddf 7bdf1a
Mensagens
93230c5 0ac78b6 7f3ddf 7bdf1a
Mensagens
93230c5 0ac78b6 7f3ddf 7bdf1a
531d4d0
Squash
93230c50ac78b67f3ddf7bdf1a
Reestruturando
commits
git rebase -i
93230c5 0ac78b6 7f3ddf 7bdf1a
git rebase -i
93230c5 7f3ddf 7bdf1a
git rebase -i
93230c5 7f3ddf7bdf1a
Rebase e
Merge
Trabalho no branch “outro” terminado
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
HEADoutro
Merge outro
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
masterd4545ea HEAD
Trabalho no branch “outro” terminado
= commit
= branch
= HEAD
93230c5 0ac78b6
c77926b
4ebf653
master
HEADoutro
git rebase master
= commit
= branch
= HEAD
93230c5 0ac78b6 c77926b4ebf653
master
HEADoutro
git rebase master
= commit
= branch
= HEAD
93230c5 0ac78b6 c77926b4ebf653
master
HEADoutro39e168
git checkout master && git merge outro
= commit
= branch
= HEAD
93230c5 0ac78b6 c7792624ebf653
master
HEADoutro39e168
git branch -d outro
= commit
= branch
= HEAD
93230c5 0ac78b6 c7792624ebf653 master39e168 HEAD
git branch -d outro
= commit
= branch
= HEAD
93230c5 0ac78b6 c7792624ebf653 master39e168 HEAD
Ammend
Pequena correção
93230c5
git commit --amend
93230c539e168
git commit --amend --no-edit
93230c545fa67
Demo
Rebase
Trabalhando sem medo
Crie outro branch
Estou com medo do rebase
93230c5 0ac78b6 7f3ddf 7bdf1a
gb/nf HEADmaster
= commit
= branch
= HEAD
git checkout -b temp
93230c5 0ac78b6 7f3ddf 7bdf1a
gb/nfmaster
= commit
= branch
= HEAD
temp HEAD
Após o squash
93230c5 0ac78b6 7f3ddf 7bdf1a
gb/nfmaster
= commit
= branch
= HEAD
temp HEAD
531d4d0
0ac
78b
6
7f3
ddf
7bd
f1a
Após o reset
93230c5 0ac78b6 7f3ddf 7bdf1a
master
= commit
= branch
= HEAD
gb/nf HEAD
531d4d0
0ac
78b
6
7f3
ddf
7bd
f1a
git worktree
Status inicial
~/projects/myproj
gb/nf
Troca de branches padrão
~/projects/myproj
gb/fix-login
node_modules?
Status inicial
~/projects/myproj
gb/nf
Com git worktree
~/projects/myproj
gb/nf
~/projects/myproj-fix
gb/fix-login
Clone local
Clone local
93230c5 0ac78b6
master
~/projects/myproj
git clone myproj myproj2
93230c5 0ac78b6
master
~/projects/myproj
~/projects/myproj293230c5 0ac78b6
master remote
Commit
93230c5 0ac78b6
master
93230c5 0ac78b6
master
b8e46ef
git pull ../myproj2
93230c5 0ac78b6
93230c5 0ac78b6
master
b8e46ef
master
b8e46ef
Cópia local
Status inicial
~/p/myproj
~/p/myproj/.git
~/p/myproj/node_modules
cp -R myproj myproj2
~/p/myproj
~/p/myproj/.git
~/p/myproj/node_modules
~/p/myproj2
~/p/myproj2/.git
~/p/myproj2/node_modules
Errou feio, errou rude
O git grava tudo
que você faz
no seu repo local
Para veja o que
foi gravado usando
git reflog
Demo
git reflog
Encontrando
bugs com git
• Em qual commit esse bug entrou?
• Há quanto tempo eu tenho esse bug?
Demo
git bisect
Trabalho
paralelo
NEW
DIRTY
DELETED
932 HEADmaster
NEW
DIRTY
Você poderia parar
tudo e fazer essa
feature nova?
DELETED
NEW
DIRTY
DELETED
git stash
NEW
DIRTY
DELETED
932 HEADmaster
932
HEAD
master
gb/temp
932
HEAD
master
gb/temp458
git checkout -b gb/temp
git commit
932 HEADmaster
932
HEAD
master
gb/temp
932
HEAD
master
gb/temp458
932 HEADmaster
gb/temp458
git checkout -b gb/temp
git commit
git checkout master
~/projects/myproj
gb/master
NEW
DIRTY
DELETED
~/projects/myproj
gb/master
~/projects/myproj-fix
gb/fix
NEW
DIRTY
DELETED
~/projects/myproj
gb/master
~/projects/myproj-fix
gb/fix
NEW
DIRTY
DELETED
branches
diferentes!
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
dicas úteis
git cherry pick
git checkout -b branch_novo
git checkout branch_original
git reset --hard HEAD^
git
--no-pager
--git-dir=<original_dir>/.git
format-patch
-k
-1
--no-color
--stdout <commit_sha>
|
git am -3 -k --ignore-whitespace
http://bit.ly/copycommit
st = status
ci = commit
co = checkout
br = branch
fixup = commit --all --amend --no-edit
open = !explorer `git config remote.origin.url`
browse = !git open
up = push upstream master
sync = pull upstream master --rebase
which = !git branch | grep -i
daily = !sh -c 'git log --since=yesterday --
format=%s --author=Giovanni'
serve = daemon --reuseaddr --verbose --base-
path=. --export-all ./.git
hub.github.com
git clone seurepo
git clone user/repo
git browse
git browse -- issues
git browse user/repo wiki
git fork
git create
git checkout https://github.com/user/repo/pull/123
Sendo ágil com git
Sendo ágil com git
Sendo ágil com git
w w w. l a m b d a 3 . c o m . b r
Obrigado!
@giovannibassi
/giggio.tech

More Related Content

PDF
Git - Get Ready To Use It
PDF
Honestly Git Playground 20190221
PDF
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
PDF
Did you git yet?
PPT
version_control_lectures_for _git_all.ppt
PPTX
Git and git workflow best practice
ODP
In Git we trust, by Carlos Guzman
PDF
git fail --force (make it up with your pull requests)
Git - Get Ready To Use It
Honestly Git Playground 20190221
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Did you git yet?
version_control_lectures_for _git_all.ppt
Git and git workflow best practice
In Git we trust, by Carlos Guzman
git fail --force (make it up with your pull requests)

Similar to Sendo ágil com git (20)

PDF
Getting some Git
PDF
Simplify writing code with deliberate commits - London Python Meetup
PPTX
Git basics
PDF
Loading...git
PPTX
YET ANOTHER INTRODCTION AND AN EXAMPLE HOW NOT TO USE BAD PRESENTATION STYLES
KEY
Git Distributed Version Control System
PDF
How to Really Get Git
PDF
Git branching model_for_tap_team
PDF
#3 - Git - Branching e Merging
PDF
Github integration-kostyasha
PDF
Git For The Android Developer
PPTX
Jedi Mind Tricks for Git
PPTX
Troubleshooting MySQL from a MySQL Developer Perspective
PDF
Sacándole jugo a git
PDF
Automated Drupal deployment with Git and Capistrano
PDF
Jedi Mind Tricks in Git
PDF
Becoming a Git Master
KEY
Git Magic: Versioning Files like a Boss
PPT
PDF
Keep you GIT history clean
Getting some Git
Simplify writing code with deliberate commits - London Python Meetup
Git basics
Loading...git
YET ANOTHER INTRODCTION AND AN EXAMPLE HOW NOT TO USE BAD PRESENTATION STYLES
Git Distributed Version Control System
How to Really Get Git
Git branching model_for_tap_team
#3 - Git - Branching e Merging
Github integration-kostyasha
Git For The Android Developer
Jedi Mind Tricks for Git
Troubleshooting MySQL from a MySQL Developer Perspective
Sacándole jugo a git
Automated Drupal deployment with Git and Capistrano
Jedi Mind Tricks in Git
Becoming a Git Master
Git Magic: Versioning Files like a Boss
Keep you GIT history clean
Ad

More from Giovanni Bassi (20)

PPTX
O que aprendi montando a arquitetura de microsserviços
PDF
Analisando dumps de memória de aplicações .NET
PPTX
Novidades do c# 7 e 8
PPTX
Async e await com JavaScript: entenda e use agora
PPTX
Conhecendo o AKS, o azure container services com kubernetes
PPTX
Novidades do .NET Core 2.1 e do ASP.NET Core 2.1
PPTX
C#7, 7.1, 7.2, 7.3 e C# 8
PPTX
Engenharia ágil de ponta a ponta do clone ao deploy
PPTX
Entrega contínua fica mais fácil com contêineres
PPTX
.NET Core, ASP.NET Core e .NET Standard 2
PPTX
.NET com contêineres Windows e Linux
PPTX
Async e await com JavaScript: entenda e use agora
PPTX
Compartilhando código entre frontend e backend com Node.js
PPTX
Construindo uma ferramenta CLI multiplataforma com Node.js
PDF
O Futuro do C#: C#8
PDF
Um mergulho nos containers windows
PPTX
Por dentro do .NET Core
PPTX
Build e release pipeline com docker
PPTX
Release contínuo de um microsserviço com Docker ASP.net core e Azure Containe...
PPTX
Backend na nuvem com docker
O que aprendi montando a arquitetura de microsserviços
Analisando dumps de memória de aplicações .NET
Novidades do c# 7 e 8
Async e await com JavaScript: entenda e use agora
Conhecendo o AKS, o azure container services com kubernetes
Novidades do .NET Core 2.1 e do ASP.NET Core 2.1
C#7, 7.1, 7.2, 7.3 e C# 8
Engenharia ágil de ponta a ponta do clone ao deploy
Entrega contínua fica mais fácil com contêineres
.NET Core, ASP.NET Core e .NET Standard 2
.NET com contêineres Windows e Linux
Async e await com JavaScript: entenda e use agora
Compartilhando código entre frontend e backend com Node.js
Construindo uma ferramenta CLI multiplataforma com Node.js
O Futuro do C#: C#8
Um mergulho nos containers windows
Por dentro do .NET Core
Build e release pipeline com docker
Release contínuo de um microsserviço com Docker ASP.net core e Azure Containe...
Backend na nuvem com docker
Ad

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Tartificialntelligence_presentation.pptx
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Machine Learning_overview_presentation.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Big Data Technologies - Introduction.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Programs and apps: productivity, graphics, security and other tools
Unlocking AI with Model Context Protocol (MCP)
Machine learning based COVID-19 study performance prediction
Encapsulation_ Review paper, used for researhc scholars
SOPHOS-XG Firewall Administrator PPT.pptx
1. Introduction to Computer Programming.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Tartificialntelligence_presentation.pptx
Getting Started with Data Integration: FME Form 101
Machine Learning_overview_presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Big Data Technologies - Introduction.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Assigned Numbers - 2025 - Bluetooth® Document
Programs and apps: productivity, graphics, security and other tools

Sendo ágil com git

Editor's Notes

  • #23: cd .git cat HEAD cat refs/heads/master ls objects/xx/yyyyy (sendo que xx são os primeiros 2 dígitos do commit, e yyyyy são o restante do SHA) git cat-file –p xxyyyyyyyy git show xxyyyyyyyy ls refs cat refs/remotes/origin/master
  • #57: cd C:\p\samplegitrepo git co create101to200 #mostra o merge git merge remove1s #limpa tudo git reset --hard HEAD^ #mostra o squash git rebase -i master #mostra o rebase git rebase remove1s
  • #80: cd C:\p\samplegitrepo git checkout create101to200withmanycommitsanderror git reset --hard HEAD^^
  • #83: cd C:\p\samplegitrepo git checkout create101to200withmanycommitsanderror git bisect start git bisect bad #rever o log e notar que no master estava ok git log git checkout master git bisect good #checar com: ls | % { $(cat $_).Contains('ERR') } | ? { $_ -eq $true } # fazer varios git bisect bad e good ate achar o commit #mostrar novamente com script git bisect reset git checkout create101to200withmanycommitsanderror-scriptforbisect cp bisect.ps1 \temp git bisect start git bisect bad git checkout master git bisect good git bisect run \temp\bisect.sh