SlideShare une entreprise Scribd logo
1  sur  21
Lets talk about GIT
              Stupid, fast, distributed content tracker


                                             Roni Saha
                                      Sr. Software Engineer
Rightbrain Solution Limited & Emicrograph Business Solution
Git uses a distributed model
     Centralized Model        Distributed Model




(CVS, Subversion, Perforce)



                                      (Git, Mercurial)
                              Result: Many operations are local
Git local file lifecycle


untracked         unmodified              modified               staged




                          edit the file
      add the file
                                                stage the file

        remove the file
                                           commit
Overview of Git Workflow/Commands
Git commands
                 command                                     description
git clone url [dir]                          copy a git repository so you can add to it
git add files                                adds file contents to the staging area
git commit                                   records a snapshot of the staging area
git status                                   view the status of your files in the
                                             working directory and staging area
git diff                                     shows diff of what is staged and what is
                                             modified but un-staged
git pull                                     fetch from a remote repo and try to
                                             merge into the current branch
git push                                     push your new branches and data to a
                                             remote repository


                  others: init, reset, branch, checkout, merge, log, tag
Typical Development Workflow
                        Get the code

 git clone some-repo                        git pull

                        Modify Code

       Cerate                             Delete/Edit

                       Save the changes

       git add                      git commit -m "message"

                       Sync with remote

       git pull                             git push
Branch VS Tag


Branch                         Tags
• A branch is just a line of   • Milestone in the life of
  development                    project
• “Branch head” mean a         • Read Only, i.e. reference
  reference to the most          to a fixed commit id
  recent commit on a branch
Merge, The Blessing!!

Some merge Strategies

Resolve       This can only resolve two heads

Recursive     Default strategy when pulling or merging one branch

Octopus       More than two branches

Ours/Theirs   Just mark as merged

No-commit     Do not create a new commit automatically
Conflict, The Devil!!
Resolve Conflict

                               Resolve
• Decide not to                actions!
  merge
                      • $ git merge --abort
• Resolve the
                      • Edit the files into
  conflicts
                        shape then commit

         Conflict
Client is always right!!

Git allows you to use git locally and use SVN as a remote repository


   Create Git clone of Subversion repo
    • $ git svn clone -s svn://example.com/repo

   Update from SVN
    • $ git svn rebase

   Commit to SVN
    • $ git svn dcommit
Case Studies
Merge Commands

 Merge branches fixes and enhancement to the current branch, making an octopus merge:
 $ git merge fixes enhancements

 Merge branch obsolete into the current branch, using ours merge strategy:
 $ git merge -s ours obsolete

 Merge branch partial into the current branch, but do not make a new commit automatically:
 $ git merge --no-commit partial

 Cancel a merge:
 $ git merge --abort
Cancel/Fix a commit
 From latest to some point
 $ git reset –<hard/soft> <where>
 …..
 Edit
 …….
 $ git add ....
 $ git commit -c ORIG_HEAD

 Some commit in the past
 $ git revert <commit>

 Fix latest commit
 $ git commit --amend
Partial commit

 You made several unrelated changes to the same file
 $ git add -p
 <Opens up an interactive session>
 <Choose which hunk of each patch to add to the index>
Pulling into a dirty tree




  • git stash save, git pull, git stash pop
Suspend work for a fix




• git stash save, do the fix, commit, git stash pop
Moving work to a branch
Moving work to a branch

    Switch to (Create) the “v1.12"
    branch
    • git checkout v1.12[git merge master]
    • Or git checkout -b v1.12

    Forcibly move master back to
    early stage
    • git branch -f master HEAD^^^
Any More… Case Studies/Question?
Thank You

Contenu connexe

Tendances

Systems Thinking Training Course
Systems Thinking Training CourseSystems Thinking Training Course
Systems Thinking Training Course
Bryan Len
 
Community Of Practice (Co P)
Community Of Practice (Co P)Community Of Practice (Co P)
Community Of Practice (Co P)
Mike Baker
 
Sean and karen franklin covey seven habits
Sean and karen franklin covey seven habitsSean and karen franklin covey seven habits
Sean and karen franklin covey seven habits
Sean Bradley
 

Tendances (20)

Grow model ppt
Grow model pptGrow model ppt
Grow model ppt
 
Systems Thinking Training Course
Systems Thinking Training CourseSystems Thinking Training Course
Systems Thinking Training Course
 
From Bud to Boss: Secrets to a Successful Transition to Remarkable Leadershi...
From Bud to Boss: Secrets to a Successful Transition to Remarkable Leadershi...From Bud to Boss: Secrets to a Successful Transition to Remarkable Leadershi...
From Bud to Boss: Secrets to a Successful Transition to Remarkable Leadershi...
 
Personal Development Plan & Mentoring
Personal Development Plan & MentoringPersonal Development Plan & Mentoring
Personal Development Plan & Mentoring
 
Community Of Practice (Co P)
Community Of Practice (Co P)Community Of Practice (Co P)
Community Of Practice (Co P)
 
Research on Success: Grit, growth mindset, and the marshmallow test
Research on Success: Grit, growth mindset, and the marshmallow testResearch on Success: Grit, growth mindset, and the marshmallow test
Research on Success: Grit, growth mindset, and the marshmallow test
 
Team and team work
Team and team workTeam and team work
Team and team work
 
What is mentoring
What is mentoringWhat is mentoring
What is mentoring
 
Passport to passive income
Passport to passive incomePassport to passive income
Passport to passive income
 
10 keys to being unstoppable
10 keys to being unstoppable10 keys to being unstoppable
10 keys to being unstoppable
 
Sean and karen franklin covey seven habits
Sean and karen franklin covey seven habitsSean and karen franklin covey seven habits
Sean and karen franklin covey seven habits
 
Leadership Vision
Leadership VisionLeadership Vision
Leadership Vision
 
Relationship Building- The WHAT, WHY and HOW
Relationship Building- The WHAT, WHY and HOWRelationship Building- The WHAT, WHY and HOW
Relationship Building- The WHAT, WHY and HOW
 
Team management
Team managementTeam management
Team management
 
What are systems and how does this apply to school leadership
What are systems and how does this apply to school leadership What are systems and how does this apply to school leadership
What are systems and how does this apply to school leadership
 
Designing 70:20:10 learning campaigns
Designing 70:20:10 learning campaignsDesigning 70:20:10 learning campaigns
Designing 70:20:10 learning campaigns
 
20 Rules of Change Management in Organizations by Catherine Adenle
20 Rules of Change Management in Organizations by Catherine Adenle20 Rules of Change Management in Organizations by Catherine Adenle
20 Rules of Change Management in Organizations by Catherine Adenle
 
Leadership & Team Building
Leadership & Team BuildingLeadership & Team Building
Leadership & Team Building
 
Ways To Improve Your Work Performance
Ways To Improve Your Work PerformanceWays To Improve Your Work Performance
Ways To Improve Your Work Performance
 
Team Goal Setting Workshop
Team Goal Setting WorkshopTeam Goal Setting Workshop
Team Goal Setting Workshop
 

En vedette (9)

Tcvn 7505 2005 vach kinh
Tcvn 7505 2005 vach kinhTcvn 7505 2005 vach kinh
Tcvn 7505 2005 vach kinh
 
Wirelessnetworks mohit mehra
Wirelessnetworks mohit mehraWirelessnetworks mohit mehra
Wirelessnetworks mohit mehra
 
Tcxd 195 97 nha cao tang -tke coc khn
Tcxd 195  97 nha cao tang -tke coc khnTcxd 195  97 nha cao tang -tke coc khn
Tcxd 195 97 nha cao tang -tke coc khn
 
Curriculum vitae
Curriculum vitaeCurriculum vitae
Curriculum vitae
 
Tcvn 7571 2006 thép hình
Tcvn 7571 2006 thép hìnhTcvn 7571 2006 thép hình
Tcvn 7571 2006 thép hình
 
Масленица в детском саду
Масленица в детском садуМасленица в детском саду
Масленица в детском саду
 
Праздник 8 марта
Праздник 8 мартаПраздник 8 марта
Праздник 8 марта
 
Session1 strategic planning presentation1
Session1 strategic planning presentation1Session1 strategic planning presentation1
Session1 strategic planning presentation1
 
Working with and around our equipment1
Working with and around our equipment1Working with and around our equipment1
Working with and around our equipment1
 

Similaire à Session git

Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
Chen-Han Hsiao
 

Similaire à Session git (20)

Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git basic
Git basicGit basic
Git basic
 
Getting started with GIT
Getting started with GITGetting started with GIT
Getting started with GIT
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git
GitGit
Git
 
Git
GitGit
Git
 
Source control management
Source control managementSource control management
Source control management
 
Git
GitGit
Git
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
 
Git slides
Git slidesGit slides
Git slides
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Git
GitGit
Git
 

Dernier

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

Session git

  • 1. Lets talk about GIT Stupid, fast, distributed content tracker Roni Saha Sr. Software Engineer Rightbrain Solution Limited & Emicrograph Business Solution
  • 2. Git uses a distributed model Centralized Model Distributed Model (CVS, Subversion, Perforce) (Git, Mercurial) Result: Many operations are local
  • 3. Git local file lifecycle untracked unmodified modified staged edit the file add the file stage the file remove the file commit
  • 4. Overview of Git Workflow/Commands
  • 5. Git commands command description git clone url [dir] copy a git repository so you can add to it git add files adds file contents to the staging area git commit records a snapshot of the staging area git status view the status of your files in the working directory and staging area git diff shows diff of what is staged and what is modified but un-staged git pull fetch from a remote repo and try to merge into the current branch git push push your new branches and data to a remote repository others: init, reset, branch, checkout, merge, log, tag
  • 6. Typical Development Workflow Get the code git clone some-repo git pull Modify Code Cerate Delete/Edit Save the changes git add git commit -m "message" Sync with remote git pull git push
  • 7. Branch VS Tag Branch Tags • A branch is just a line of • Milestone in the life of development project • “Branch head” mean a • Read Only, i.e. reference reference to the most to a fixed commit id recent commit on a branch
  • 8. Merge, The Blessing!! Some merge Strategies Resolve This can only resolve two heads Recursive Default strategy when pulling or merging one branch Octopus More than two branches Ours/Theirs Just mark as merged No-commit Do not create a new commit automatically
  • 10. Resolve Conflict Resolve • Decide not to actions! merge • $ git merge --abort • Resolve the • Edit the files into conflicts shape then commit Conflict
  • 11. Client is always right!! Git allows you to use git locally and use SVN as a remote repository Create Git clone of Subversion repo • $ git svn clone -s svn://example.com/repo Update from SVN • $ git svn rebase Commit to SVN • $ git svn dcommit
  • 13. Merge Commands  Merge branches fixes and enhancement to the current branch, making an octopus merge: $ git merge fixes enhancements  Merge branch obsolete into the current branch, using ours merge strategy: $ git merge -s ours obsolete  Merge branch partial into the current branch, but do not make a new commit automatically: $ git merge --no-commit partial  Cancel a merge: $ git merge --abort
  • 14. Cancel/Fix a commit  From latest to some point $ git reset –<hard/soft> <where> ….. Edit ……. $ git add .... $ git commit -c ORIG_HEAD  Some commit in the past $ git revert <commit>  Fix latest commit $ git commit --amend
  • 15. Partial commit  You made several unrelated changes to the same file $ git add -p <Opens up an interactive session> <Choose which hunk of each patch to add to the index>
  • 16. Pulling into a dirty tree • git stash save, git pull, git stash pop
  • 17. Suspend work for a fix • git stash save, do the fix, commit, git stash pop
  • 18. Moving work to a branch
  • 19. Moving work to a branch Switch to (Create) the “v1.12" branch • git checkout v1.12[git merge master] • Or git checkout -b v1.12 Forcibly move master back to early stage • git branch -f master HEAD^^^
  • 20. Any More… Case Studies/Question?