際際滷

際際滷Share a Scribd company logo
Git 辿 seu amigo



                               Celestino Gomes




Saturday, September 12, 2009                     1
O qu棚?

        Criado em 2005 por Linus Torvalds

              Necessidade, linux-kernel-devs


        Originalmente, era um engine para VCS

        Fluxo de trabalho distribu鱈do

        Preven巽達o de corrup巽達o acidental

        Alta performance




Saturday, September 12, 2009                     2
Caracter鱈sticas b叩sicas

        Controle de vers達o distribuido (DVCS)

        Gerenciamento de conte炭do e n達o arquivos

        Branches como unidade de trabalho

        SHA1 para associa巽達o e veri鍖ca巽達o

        Staging index

        N達o 辿 o subversion



Saturday, September 12, 2009                        3
Como funciona?




Saturday, September 12, 2009   4
Diret坦rio .git

        Diret坦rio .git na ra鱈z de cada projeto

        Arquivos de con鍖gura巽達o (.git/config)

        Index (.git/index)

        Hooks (.git/hooks)

        Object Database (.git/objects)

        References (.git/refs)



Saturday, September 12, 2009                      5
Object Database
      Quatro tipos de objetos:

           Blob, Tree, Commit e Tag


      Todos registrados/gravados da mesma maneira




Saturday, September 12, 2009                         6
Object Database - Loose format



                   conteudo


                   header + conteudo


                    2e6f9b0d5885b6010f9167787445617f553a735f


                   zlib(header + conteudo)



                   .git/objects/2e/6f9b0d5885b6010f9167787445617f553a735f



Saturday, September 12, 2009                                                7
Object Database - Packed format

                   .git/objects/2e/6f9b0d5885b6010f9167787445617f553a735f

                   .git/objects/0b/772ec8eb9ae8952c3c1e56a9ffbe49385cc83a

                   .git/objects/72/16b02627bc3d6ef57008f7ff67f0f8f13f488e



                                                              git-gc



          .git/objects/pack/pack-0bc9a42eb66d7ae36bf44af8ff5a3888e8a02d12.idx

         .git/objects/pack/pack-0bc9a42eb66d7ae36bf44af8ff5a3888e8a02d12.pack




Saturday, September 12, 2009                                                                                                            8
Digamos que os objetos listados referenciem o mesmo arquivo, com conjuntos pequenos de diferen巽as geradas ao longo do tempo. Usar uma
ferramenta de manuten巽達o (git-gc, por exemplo) vai compactar os objetos e armazen叩-los em /pack.
Object Database - Blob

                                        Rakefile   blob: 2e6f9b



                               active_content.rb   blob: 7034fe



                          active_content_spec.rb   blob: a738fc




Saturday, September 12, 2009                                      9
Object Database - Tree

                                              /    tree: 1fba94



                                        Rakefile          blob: 2e6f9b



                                            /lib          tree: 3ef95a



                               active_content.rb                  blob: 7034fe



                                          /spec           tree: 34ba74



                  active_content_spec.rb                          blob: a738fc




Saturday, September 12, 2009                                                     10
Object Database - Commit

                                                   commit: 8d1ab4


                                              /     tree: 1fba94



                                        Rakefile    blob: 2e6f9b



                                            /lib    tree: 3ef95a



                               active_content.rb    blob: 7034fe



                                          /spec     tree: 34ba74



                  active_content_spec.rb            blob: a738fc




Saturday, September 12, 2009                                        11
Object Database - Commit

                                          commit: 8d1ab4   commit: 61db26


                                     /     tree: 1fba94     tree: 1fba94



                               Rakefile    blob: 2e6f9b     blob: 41d300



                                   /lib    tree: 3ef95a     tree: 3ef95a



                    active_content.rb      blob: 7034fe     blob: 7034fe



                                 /spec     tree: 34ba74     tree: 34ba74



       active_content_spec.rb              blob: a738fc     blob: 2a03fb




Saturday, September 12, 2009                                                12
Object Database - Tag

                                                    tag: 6ee1f2


                                                   commit: 8d1ab4


                                              /     tree: 1fba94


                                        Rakefile    blob: 2e6f9b


                                            /lib    tree: 3ef95a


                               active_content.rb    blob: 7034fe



                                          /spec     tree: 34ba74


                  active_content_spec.rb            blob: a738fc




Saturday, September 12, 2009                                        13
Object Database - Resumindo




Saturday, September 12, 2009         14
Object Database - Resumo

        Blob 辿 o menor objeto do git

        Tree cont辿m Trees e Blobs

        Commit cont辿m Commits, Trees e Blobs

        Tags cont辿m/apontam um Commit




Saturday, September 12, 2009                    15
References

                   .git/refs/heads/master                     master                      HEAD



                                                         commit: 8d1ab4


                                              /           tree: 1fba94


                                Rakefile                  blob: 2e6f9b


                                        /lib              tree: 3ef95a


                   active_content.rb                      blob: 7034fe



                                      /spec               tree: 34ba74


       active_content_spec.rb                             blob: a738fc




Saturday, September 12, 2009                                                                                                             16
Um branch 辿 um ponteiro para um commit. Quando se avan巽a um branch adicionando commits, o que est叩 acontecendo, por baixo dos panos, 辿
mudar o ponteiro do branch para um novo commit.
Staging Index


                                 lib.rb      Untracked

                                   $ git add lib.rb


                                 lib.rb          Staged

                               $ git commit -m lib.rb


                                 lib.rb      Commited


Saturday, September 12, 2009                              17
Flow b叩sico




Saturday, September 12, 2009   18
Cria巽達o de reposit坦rios

       Criando um novo reposit坦rio

          $ rails my_blog
          ...
          $ cd my_blog
          $ git init
          $ git add .
          $ git commit -m Initial commit

      Criando um reposit坦rio a partir de um outro

          $ git clone git://github.com/tinogomes/my_blog_app_with_bug.git
          $ cd my_blog_app_with_bug
          $ git branch
          master



Saturday, September 12, 2009                                                19
Trabalhando em um branch remoto


            $ cd my_blog_app_with_bug
            $ git checkout -b refactoring origin/refactoring
            ... ap坦s modifica巽探es
            $ echo tmp > .gitignore
            $ git add .
            $ git commit -m outras modificacoes
            $ git pull
            $ git push origin refactoring




Saturday, September 12, 2009                                   20
Indo al辿m do 鍖ow b叩sico




Saturday, September 12, 2009     21
Adicionando arquivos



                                    $ git add <dir>


                               $ git add <dir>/<arquivo>



                                   $ git add *.rb



                                $ git add . (cuidado)




Saturday, September 12, 2009                               22
Trabalhando com branch local

          $ cd my_blog_app_with_bug
          $ git branch meu_branch_local
          ...
          $ git checkout master
          $ git pull . master
          $ git push origim master



          $ git branch -d meu_branch_local




Saturday, September 12, 2009                 23
Navegando pelo hist坦rico

         $ git log --stat

         commit 7f5a85113381e8c0d16e4679c4e5a81a4eb000b8
         Author: Celestino Gomes <celestino@HDU15121-ADIGITAL.local>
         Date:   Sat Sep 12 02:22:52 2009 -0300

                Initial commit



          README                                     | 243 ++
          Rakefile                                   |   10 +
          app/controllers/application_controller.rb |    10 +
          app/helpers/application_helper.rb          |    3 +
          config/boot.rb                             | 110 +
         ...
          test/performance/browsing_test.rb          |    9 +
          test/test_helper.rb                        |   38 +
          41 files changed, 8452 insertions(+), 0 deletions(-)




Saturday, September 12, 2009                                           24
Navegando pelo hist坦rico
         $ git log -p --no-merges

         commit 7f5a85113381e8c0d16e4679c4e5a81a4eb000b8
         Author: Celestino Gomes <celestino@HDU15121-ADIGITAL.local>
         Date:   Sat Sep 12 02:22:52 2009 -0300

                Initial commit

         diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb
         new file mode 100644
         index 0000000..4b60558
         --- /dev/null
         +++ b/test/performance/browsing_test.rb
         @@ -0,0 +1,9 @@
         +require 'test_helper'
         +require 'performance_test_help'
         +
         +# Profiling results for each test method are written to tmp/performance.
         +class BrowsingTest < ActionController::PerformanceTest
         + def test_homepage
         +    get '/'
         + end
         +end


Saturday, September 12, 2009                                                                  25
Navegando pelo hist坦rico
   $ git log --pretty=oneline

   7f5a85113381e8c0d16e4679c4e5a81a4eb000b8 Initial commit

   $ git blame app/helpers/application_helper.rb

   ^7f5a851 (Celestino Gomes 2009-09-12 02:22:52 -0300 1) module ApplicationHelper
   ^7f5a851 (Celestino Gomes 2009-09-12 02:22:52 -0300 2) end




Saturday, September 12, 2009                                                         26
Manipulando o 鱈ndice

       Remove do stage index

                  $ git reset [<commit>]

       Limpa os arquivos, inclusive os unstagged

                  $ git reset --hard [<commit>]
       Coloca os arquivos de volta para o stage index

                  $ git reset --soft [<commit>]

       Permite alterar o 炭ltimo commit

                  $ git commit --amend




Saturday, September 12, 2009                            27

<commit> - default HEAD
A diferen巽a entre merge e rebase


                               master   sprint_branch



                                C1



                                C2          C4



                                C3          C5




Saturday, September 12, 2009                            28
A diferen巽a entre merge e rebase

                       master      sprint_branch



                         C1
                                                   $ git checkout master
                                                   $ git pull . sprint_branch
                         C2            C4
                                                                 ou

                                                   $ git checkout master
                         C3            C5          $ git fetch
                                                   $ git merge sprint_branch


                         C6     merge commit




Saturday, September 12, 2009                                                    29
A diferen巽a entre merge e rebase

                       master



                         C1
                                      $ git checkout master
                                      $ git pull --rebase . sprint_branch
                         C2     C4
                                                       ou

                                      $ git checkout master
                         C3     C5    $ git fetch
                                      $ git rebase sprint_branch


                        C4     C5




Saturday, September 12, 2009                                                30
Usando o stash


                                      $ git stash


                                   $ git stash list


                               $ git stash show stash@{0}


                                   $ git stash apply


                               $ git stash drop stash@{0}




Saturday, September 12, 2009                                31
Revertendo commits


                                $ git revert <commit_hash>


                               $ git revert -n <commit_hash>




Saturday, September 12, 2009                                   32

-n para deixar a revers達o no index
Buscando por bugs


                                     $ git bisect start [<bad> [<good>]]


                                         $ git bisect good | bad [<rev>]


                                     $ git bisect skip [(<rev>|<range>)]


                                                       $ git bisect reset


                                         $ git bisect run <cmd | script>




Saturday, September 12, 2009                                                                                                                        33
1) Primeiro 辿 necess叩rio identi鍖car pontos (commits) bons e ruins para come巽ar a ca巽a. Usar $ git log
2) $ git bisect run my_script - Note that the "run" script (my_script in the above example) should exit with code 0 in case the current source code is
good. Exit with a code between 1 and 127 (inclusive), except 125, if the current source code is bad.
Limpando a sujeira do dia-a-dia

       Remover arquivos/diret坦rios n達o trackeados
                    $ git clean -d -f



       Remover um branch remoto

                     $ git push origin :<branch_remoto>


       Limpar todo o stash

                    $ git stash clear




Saturday, September 12, 2009                                                                                                          34
clean para remover arquivos/diret坦rios n達o trackeados, push origin :<branch> limpa branches remotos, stash para limpar todo o stash
Funciona no Windows?

        Somente atrav辿s do cygwin ou msysGit




Saturday, September 12, 2009                    35
檎艶韓艶姻棚稼界庄温壊

        http://git.or.cz/gitwiki/GitDocumentation

        http://www.kernel.org/pub/software/scm/git/docs/

        http://blog.tinogomes.com/2008/05/11/instalando-e-usando-git-
         no-windows-xp/

        http://github.com




Saturday, September 12, 2009                                             36
Perguntas




Saturday, September 12, 2009   37
Mais sobre mim




        http://blog.tinogomes.com




Saturday, September 12, 2009         38
Obrigado!




Saturday, September 12, 2009   39

More Related Content

Similar to Git E Seu Amigo (20)

PDF
Dev conf git_lecture
Juan De Bravo
PPTX
git internals
Dennis Byrne
PDF
Git internals
insanehong Kim
PDF
Git and GitHub at the San Francisco JUG
Matthew McCullough
ODP
Introduction to Git (Greg Lonnon)
Boise Web Technologies Group
PDF
What the git? - SAP Inside Track Munich 2016
Hendrik Neumann
PPTX
Six3 Getting Git
Daniel Cox
PPTX
How git works
Mohamed Ahmed
PDF
Git in action
Aleksei Kornev
PDF
Version Control and Git - GitHub Workshop
All Things Open
PDF
Git basics with notes
Surabhi Gupta
PPT
Git, Fast and Distributed Source Code Management
Salimane Adjao Moustapha
PPT
Introduction to Git for developers
Dmitry Guyvoronsky
PDF
Migrating from Subversion to Git and GitHub
Matthew McCullough
ZIP
Git censored.key
mkramer2
PDF
Getting Git Right
Sven Peters
PDF
Intro to Git and GitHub
Panagiotis Papadopoulos
PDF
Tool Time
Ken Collins
PDF
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Ahmed El-Arabawy
PDF
Git For The Android Developer
Effective
Dev conf git_lecture
Juan De Bravo
git internals
Dennis Byrne
Git internals
insanehong Kim
Git and GitHub at the San Francisco JUG
Matthew McCullough
Introduction to Git (Greg Lonnon)
Boise Web Technologies Group
What the git? - SAP Inside Track Munich 2016
Hendrik Neumann
Six3 Getting Git
Daniel Cox
How git works
Mohamed Ahmed
Git in action
Aleksei Kornev
Version Control and Git - GitHub Workshop
All Things Open
Git basics with notes
Surabhi Gupta
Git, Fast and Distributed Source Code Management
Salimane Adjao Moustapha
Introduction to Git for developers
Dmitry Guyvoronsky
Migrating from Subversion to Git and GitHub
Matthew McCullough
Git censored.key
mkramer2
Getting Git Right
Sven Peters
Intro to Git and GitHub
Panagiotis Papadopoulos
Tool Time
Ken Collins
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Ahmed El-Arabawy
Git For The Android Developer
Effective

Recently uploaded (20)

PPTX
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) 際際滷s
Ravi Tamada
PDF
MPU+: A Transformative Solution for Next-Gen AI at the Edge, a Presentation...
Edge AI and Vision Alliance
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
PDF
UiPath Agentic AI ile Ak脹ll脹 Otomasyonun Yeni a脹
UiPathCommunity
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
PPTX
叶Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) 際際滷s
Ravi Tamada
MPU+: A Transformative Solution for Next-Gen AI at the Edge, a Presentation...
Edge AI and Vision Alliance
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
Open Source Milvus Vector Database v 2.6
Zilliz
UiPath Agentic AI ile Ak脹ll脹 Otomasyonun Yeni a脹
UiPathCommunity
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
Why aren't you using FME Flow's CPU Time?
Safe Software
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
The Future of Product Management in AI ERA.pdf
Alyona Owens
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
叶Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
Ad

Git E Seu Amigo

  • 1. Git 辿 seu amigo Celestino Gomes Saturday, September 12, 2009 1
  • 2. O qu棚? Criado em 2005 por Linus Torvalds Necessidade, linux-kernel-devs Originalmente, era um engine para VCS Fluxo de trabalho distribu鱈do Preven巽達o de corrup巽達o acidental Alta performance Saturday, September 12, 2009 2
  • 3. Caracter鱈sticas b叩sicas Controle de vers達o distribuido (DVCS) Gerenciamento de conte炭do e n達o arquivos Branches como unidade de trabalho SHA1 para associa巽達o e veri鍖ca巽達o Staging index N達o 辿 o subversion Saturday, September 12, 2009 3
  • 5. Diret坦rio .git Diret坦rio .git na ra鱈z de cada projeto Arquivos de con鍖gura巽達o (.git/config) Index (.git/index) Hooks (.git/hooks) Object Database (.git/objects) References (.git/refs) Saturday, September 12, 2009 5
  • 6. Object Database Quatro tipos de objetos: Blob, Tree, Commit e Tag Todos registrados/gravados da mesma maneira Saturday, September 12, 2009 6
  • 7. Object Database - Loose format conteudo header + conteudo 2e6f9b0d5885b6010f9167787445617f553a735f zlib(header + conteudo) .git/objects/2e/6f9b0d5885b6010f9167787445617f553a735f Saturday, September 12, 2009 7
  • 8. Object Database - Packed format .git/objects/2e/6f9b0d5885b6010f9167787445617f553a735f .git/objects/0b/772ec8eb9ae8952c3c1e56a9ffbe49385cc83a .git/objects/72/16b02627bc3d6ef57008f7ff67f0f8f13f488e git-gc .git/objects/pack/pack-0bc9a42eb66d7ae36bf44af8ff5a3888e8a02d12.idx .git/objects/pack/pack-0bc9a42eb66d7ae36bf44af8ff5a3888e8a02d12.pack Saturday, September 12, 2009 8 Digamos que os objetos listados referenciem o mesmo arquivo, com conjuntos pequenos de diferen巽as geradas ao longo do tempo. Usar uma ferramenta de manuten巽達o (git-gc, por exemplo) vai compactar os objetos e armazen叩-los em /pack.
  • 9. Object Database - Blob Rakefile blob: 2e6f9b active_content.rb blob: 7034fe active_content_spec.rb blob: a738fc Saturday, September 12, 2009 9
  • 10. Object Database - Tree / tree: 1fba94 Rakefile blob: 2e6f9b /lib tree: 3ef95a active_content.rb blob: 7034fe /spec tree: 34ba74 active_content_spec.rb blob: a738fc Saturday, September 12, 2009 10
  • 11. Object Database - Commit commit: 8d1ab4 / tree: 1fba94 Rakefile blob: 2e6f9b /lib tree: 3ef95a active_content.rb blob: 7034fe /spec tree: 34ba74 active_content_spec.rb blob: a738fc Saturday, September 12, 2009 11
  • 12. Object Database - Commit commit: 8d1ab4 commit: 61db26 / tree: 1fba94 tree: 1fba94 Rakefile blob: 2e6f9b blob: 41d300 /lib tree: 3ef95a tree: 3ef95a active_content.rb blob: 7034fe blob: 7034fe /spec tree: 34ba74 tree: 34ba74 active_content_spec.rb blob: a738fc blob: 2a03fb Saturday, September 12, 2009 12
  • 13. Object Database - Tag tag: 6ee1f2 commit: 8d1ab4 / tree: 1fba94 Rakefile blob: 2e6f9b /lib tree: 3ef95a active_content.rb blob: 7034fe /spec tree: 34ba74 active_content_spec.rb blob: a738fc Saturday, September 12, 2009 13
  • 14. Object Database - Resumindo Saturday, September 12, 2009 14
  • 15. Object Database - Resumo Blob 辿 o menor objeto do git Tree cont辿m Trees e Blobs Commit cont辿m Commits, Trees e Blobs Tags cont辿m/apontam um Commit Saturday, September 12, 2009 15
  • 16. References .git/refs/heads/master master HEAD commit: 8d1ab4 / tree: 1fba94 Rakefile blob: 2e6f9b /lib tree: 3ef95a active_content.rb blob: 7034fe /spec tree: 34ba74 active_content_spec.rb blob: a738fc Saturday, September 12, 2009 16 Um branch 辿 um ponteiro para um commit. Quando se avan巽a um branch adicionando commits, o que est叩 acontecendo, por baixo dos panos, 辿 mudar o ponteiro do branch para um novo commit.
  • 17. Staging Index lib.rb Untracked $ git add lib.rb lib.rb Staged $ git commit -m lib.rb lib.rb Commited Saturday, September 12, 2009 17
  • 19. Cria巽達o de reposit坦rios Criando um novo reposit坦rio $ rails my_blog ... $ cd my_blog $ git init $ git add . $ git commit -m Initial commit Criando um reposit坦rio a partir de um outro $ git clone git://github.com/tinogomes/my_blog_app_with_bug.git $ cd my_blog_app_with_bug $ git branch master Saturday, September 12, 2009 19
  • 20. Trabalhando em um branch remoto $ cd my_blog_app_with_bug $ git checkout -b refactoring origin/refactoring ... ap坦s modifica巽探es $ echo tmp > .gitignore $ git add . $ git commit -m outras modificacoes $ git pull $ git push origin refactoring Saturday, September 12, 2009 20
  • 21. Indo al辿m do 鍖ow b叩sico Saturday, September 12, 2009 21
  • 22. Adicionando arquivos $ git add <dir> $ git add <dir>/<arquivo> $ git add *.rb $ git add . (cuidado) Saturday, September 12, 2009 22
  • 23. Trabalhando com branch local $ cd my_blog_app_with_bug $ git branch meu_branch_local ... $ git checkout master $ git pull . master $ git push origim master $ git branch -d meu_branch_local Saturday, September 12, 2009 23
  • 24. Navegando pelo hist坦rico $ git log --stat commit 7f5a85113381e8c0d16e4679c4e5a81a4eb000b8 Author: Celestino Gomes <celestino@HDU15121-ADIGITAL.local> Date: Sat Sep 12 02:22:52 2009 -0300 Initial commit README | 243 ++ Rakefile | 10 + app/controllers/application_controller.rb | 10 + app/helpers/application_helper.rb | 3 + config/boot.rb | 110 + ... test/performance/browsing_test.rb | 9 + test/test_helper.rb | 38 + 41 files changed, 8452 insertions(+), 0 deletions(-) Saturday, September 12, 2009 24
  • 25. Navegando pelo hist坦rico $ git log -p --no-merges commit 7f5a85113381e8c0d16e4679c4e5a81a4eb000b8 Author: Celestino Gomes <celestino@HDU15121-ADIGITAL.local> Date: Sat Sep 12 02:22:52 2009 -0300 Initial commit diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 0000000..4b60558 --- /dev/null +++ b/test/performance/browsing_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' +require 'performance_test_help' + +# Profiling results for each test method are written to tmp/performance. +class BrowsingTest < ActionController::PerformanceTest + def test_homepage + get '/' + end +end Saturday, September 12, 2009 25
  • 26. Navegando pelo hist坦rico $ git log --pretty=oneline 7f5a85113381e8c0d16e4679c4e5a81a4eb000b8 Initial commit $ git blame app/helpers/application_helper.rb ^7f5a851 (Celestino Gomes 2009-09-12 02:22:52 -0300 1) module ApplicationHelper ^7f5a851 (Celestino Gomes 2009-09-12 02:22:52 -0300 2) end Saturday, September 12, 2009 26
  • 27. Manipulando o 鱈ndice Remove do stage index $ git reset [<commit>] Limpa os arquivos, inclusive os unstagged $ git reset --hard [<commit>] Coloca os arquivos de volta para o stage index $ git reset --soft [<commit>] Permite alterar o 炭ltimo commit $ git commit --amend Saturday, September 12, 2009 27 <commit> - default HEAD
  • 28. A diferen巽a entre merge e rebase master sprint_branch C1 C2 C4 C3 C5 Saturday, September 12, 2009 28
  • 29. A diferen巽a entre merge e rebase master sprint_branch C1 $ git checkout master $ git pull . sprint_branch C2 C4 ou $ git checkout master C3 C5 $ git fetch $ git merge sprint_branch C6 merge commit Saturday, September 12, 2009 29
  • 30. A diferen巽a entre merge e rebase master C1 $ git checkout master $ git pull --rebase . sprint_branch C2 C4 ou $ git checkout master C3 C5 $ git fetch $ git rebase sprint_branch C4 C5 Saturday, September 12, 2009 30
  • 31. Usando o stash $ git stash $ git stash list $ git stash show stash@{0} $ git stash apply $ git stash drop stash@{0} Saturday, September 12, 2009 31
  • 32. Revertendo commits $ git revert <commit_hash> $ git revert -n <commit_hash> Saturday, September 12, 2009 32 -n para deixar a revers達o no index
  • 33. Buscando por bugs $ git bisect start [<bad> [<good>]] $ git bisect good | bad [<rev>] $ git bisect skip [(<rev>|<range>)] $ git bisect reset $ git bisect run <cmd | script> Saturday, September 12, 2009 33 1) Primeiro 辿 necess叩rio identi鍖car pontos (commits) bons e ruins para come巽ar a ca巽a. Usar $ git log 2) $ git bisect run my_script - Note that the "run" script (my_script in the above example) should exit with code 0 in case the current source code is good. Exit with a code between 1 and 127 (inclusive), except 125, if the current source code is bad.
  • 34. Limpando a sujeira do dia-a-dia Remover arquivos/diret坦rios n達o trackeados $ git clean -d -f Remover um branch remoto $ git push origin :<branch_remoto> Limpar todo o stash $ git stash clear Saturday, September 12, 2009 34 clean para remover arquivos/diret坦rios n達o trackeados, push origin :<branch> limpa branches remotos, stash para limpar todo o stash
  • 35. Funciona no Windows? Somente atrav辿s do cygwin ou msysGit Saturday, September 12, 2009 35
  • 36. 檎艶韓艶姻棚稼界庄温壊 http://git.or.cz/gitwiki/GitDocumentation http://www.kernel.org/pub/software/scm/git/docs/ http://blog.tinogomes.com/2008/05/11/instalando-e-usando-git- no-windows-xp/ http://github.com Saturday, September 12, 2009 36
  • 38. Mais sobre mim http://blog.tinogomes.com Saturday, September 12, 2009 38