SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Git
For the Android Developer
AnDevCon 2011 : Tony Hillerson
#AnDevCon #effectiveui
http://www.slideshare.net/thillerson/scm-for-android-developers-using-git
About Me
• Worked with Android and Git for a few years now
• O’Reilly Screencaster: Developing Android Applications
  • http://training.oreilly.com/androidapps/
  • http://training.oreilly.com/androidapps2/
• Tech Reviewer:
Preliminaries
Getting Git and Getting Set Up
What’s a Git?

 A completely ignorant, childish person with no manners.
                                                               - http://urbandictionary.com




                 Linus Torvalds
                 http://en.wikipedia.org/wiki/Linus_Torvalds
What’s a Git?


     Git is a free & open source, distributed version
    control system designed to handle everything from
   small to very large projects with speed and efficiency.
                                              - http://git-scm.com
Getting Set Up on Mac
• Homebrew - http://mxcl.github.com/homebrew/
• MacPorts - http://www.macports.org/
Getting Set Up on Windows
• msysgit -http://code.google.com/p/msysgit/
• Cygwin - http://www.cygwin.com/
Getting Set Up on Linux
• apt, etc - you probably know the drill
Gooies!
• Git Tower - http://git-tower.com                                                           M
• Brother Bard’s GitX fork -
Mac                            http://brotherbard.com/blog/2010/03/experimental-gitx-fork/
                                                                                             A
                                                                                             C

•     Tortoise Git - http://code.google.com/p/tortoisegit/                                   W
Mac
                                                                                             I
                                                                                             N
Eclipse Integration
• http://www.eclipse.org/egit/
Reference
• Git - http://git-scm.com/
• ProGit - http://progit.org/book/ - Scott Chacon
• Insider Guide to Github - http://www.pragprog.com/screencasts/
   v-scgithub/insider-guide-to-github - Scott Chacon
Note
• Code may be in backticks: `git <command>`
  • Don’t input the backticks
The Command Line
A Short Sermon
Seven Use Cases
Where Git will Make your Life Easier
Project History
Git will Make your Life Easier
Why Source Control
• For the solo developer?
   •   Protection against mistakes
   •   Freedom
       •   to refactor
       •   to experiment


• For the development team?
   •   All of the above, plus:
   •   Parallel development
   •   Merging different code branches
Simple Commands
• `git init`- Creates an empty Git repository
• .gitignore - tells git to ignore certain files
• `git add` - Adds a file to the stage (“stages a file”)
• `git rm` - Removes from version control
• `git commit` - Commits the staged changes to the (local)
   repository

• `git log`
• `git add -i` Interactive Add
git               git
         or      clone
init


                 git                  86650c185eda50c9f9d58e2fbdf8b7113e5dee54
                         git commit
   changes       add

                 git
                         git commit   6facfd9f34173f4fb024196996e948a87c85eb56
   changes       add

                 git
                         git commit   b02ef5bf190e28ba24eab3ffab6133181cb5b5ef
   changes       add



       ...   ∞
Simple Workflow
.gitignore
• Can be nested deeply
• https://github.com/github/gitignore
  • Use it! Contribute!
Git Log - The Project’s History
• What got committed?
• Commit messages
• Content
• When? Who?
What’s With all the Characters?
86650c185eda50c9f9d58e2fbdf8b7113e5dee54
• SHA1 Hash
• Uniquely identifies a commit
• Secure - very unlikely that someone can tamper with content in a
  repository


       “... to have a probability of a SHA1-hash collision rise to 1/2,
       you need about 10^24 objects ...”
    - Scott Chacon in Pro Git (paraphrased)
Interactive Add - Building Commits
• `git add` simply adds to the stage
• `git commit -a` will commit all changes to tracked files (add and
   commit)

• `git add -i` -- a command line tool to interactively add changes
• Individual commits shouldn’t leave things broken
• Try to commit some useful feature or bug fix all together
Getting Out of Trouble
Git will Make your Life Easier
Advanced Commands
• blame
• checkout
• commit -a
• reset
• stash
• commit --amend
• revert
git blame
• remember: git help blame
• Who broke the build??? etc...
git checkout, commit -a, reset
• remember: git help reset
• `git commit -a` = commit bypassing `git add`
• `git checkout <filename>` = remove all unstaged changes
• `git reset <filename>` = opposite of `git add <filename>`
• `git reset HEAD` = same as above - acts on all changes
• `git reset HEAD^` (also ^^, or ~1, ~42, etc.) = rollback commits
   to working tree

• `git reset --soft` = rollback commit to stage
git stash
• remember: git help stash
• Stash away changes in a safe place
git commit --amend
• Oops! I misspelled something in the commit message
• Oops! I did `git commit -a` and forgot to `git add` a file
• Oops! I just committed a bug
• USE ONLY BEFORE YOU SHARE CHANGES
git revert
• Commits the reverse of a commit
• The previous commit is still there
• != svn revert
Collaboration
Git will Make your Life Easier
Remotes
• remote add
• push
• clone
• pull
• fetch
Strategies
• Star
• Peer to Peer
• Blessed Repository
• Hierarchical
Committer


              Committer                Committer




                           “The
       Committer          Server”                  Committer




                           Committer




Star
• ssh://user@computer:path/to/repo.git
• http                           Peer

• Gitosis
• Gitolite
                     Peer                Peer




Peer to N Peers
Dictator      ... etc. Maintains a “blessed repository”




            Lieutenant                                                Lieutenant




Developer                Developer              Developer                                      Developer




Hierarchical (Linux model)
Topical Development
Git will Make your Life Easier
Branching
• checkout -b
• merging
• Rebasing
• cherry-pick
How To Think About Branching
• Topic Branches
• Mainline
  • What do you want “master” to mean?
• Branching examples
Topic Branches
• Branching is about controlling feature sets
• Make a new branch for a story
• Make a new branch for a bug fix
• Make a new branch to spike something
Team Branching Strategies
• What do you want “master” to mean?
• Keep master deployable?
  • one strategy for web software
• Use “master” as an integration branch?
  • Each developer uses topic branches and integrates to master
  • Make a branch for releases
Branching
                           git checkout -b add_login_activity




master


Mac
      fb4f5d9   c5083fa



                          add_login_activity


                          Mac

                                9aa8827        fe594ce    ccb6f5e
Branching: Merging

                                                git checkout master

                                                                      git merge add_login_activity

master


Mac                                                                     9aa8827        fe594ce       ccb6f5e
      fb4f5d9   c5083fa           3f43fa3




                      add_login_activity


                      Mac

                            9aa8827         fe594ce        ccb6f5e
Branching: Rebasing
 master

 Mac
       fb4f5d9   c5083fa         3f43fa3



                           add_login_activity


        before             Mac
                            9aa8827             fe594ce           ccb6f5e



master

Mac
      fb4f5d9    c5083fa         3f43fa3



                                                  add_login_activit

        after                                     Mac
                                                        9aa8827        fe594ce   ccb6f5e
        `git rebase master`
Branching: Rebasing
• Better than merging
• Don’t use if you’ve pushed your branch to a remote
  • Git will complain about refs
  • Can override with `git push -force`
• Also available on `git pull --rebase`
  • Helpful for avoiding merge commits
  • May cause problems if git can’t automatically merge
     • `git reset HEAD` and start over with normal `git pull`
Cherry-pick

                 git cherry-pick fe594ce


                                                       A new commit
master                                                with the changes
                                                       from fe594ce

Mac
      fb4f5d9   c5083fa           3f43fa3




                      add_login_activity


                      Mac

                            9aa8827         fe594ce            ccb6f5e
Cherry Picking
• Doesn’t add a reference to the old commit
• Only applies the changes
• Future merges should apply cleanly
Release Management
Git will Make your Life Easier
Tagging
• tag
• push --tags
Tagging

      git tag -a -m"Tagging v1.0" v1.0 c5083fa



master


Mac
      fb4f5d9        c5083fa        3f43fa3




• Both -v1.0 and c5083fa will point to c5083fa
• Push this tag with `git push --tags`
• Can be cryptologically signed
Bug Fixing
Git will Make your Life Easier
Bug Fixing
• blame
• bisect
Bisect
  git bisect start                                                            HEAD
  git bisect bad



         fb4f5d9
       Mac
                     c5083fa   3f43fa3   9aa8827   fe594ce   ccb6f5e        2e531cb



  git bisect good fb4f5d9                 HEAD




         fb4f5d9
       Mac
                     c5083fa   3f43fa3   9aa8827   fe594ce   ccb6f5e        2e531cb



  git bisect good
                                                                       Git tells you
                                                                       this was the
  git bisect good
                                                                       first bad
  git bisect bad                                                       commit
                                                             HEAD




         fb4f5d9
       Mac
                     c5083fa   3f43fa3   9aa8827   fe594ce   ccb6f5e        2e531cb
Open Source Code
Git will Make your Life Easier
Github.com
• Search it!
• Forking
• Pull Requests
Thank you!




Git
For the Android Developer
AnDevCon 2011 : Tony Hillerson

Weitere ähnliche Inhalte

Was ist angesagt?

Why You Should Be Using Git
Why You Should Be Using GitWhy You Should Be Using Git
Why You Should Be Using GitFrancisco Vieira
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubNick Quaranto
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
GitBlit plugin for Gerrit Code Review
GitBlit plugin for Gerrit Code ReviewGitBlit plugin for Gerrit Code Review
GitBlit plugin for Gerrit Code ReviewLuca Milanesio
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with GitRick Umali
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answersDeepQuest Software
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAdam Culp
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemAlbanLevy
 

Was ist angesagt? (19)

Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Why You Should Be Using Git
Why You Should Be Using GitWhy You Should Be Using Git
Why You Should Be Using Git
 
Git advanced
Git advancedGit advanced
Git advanced
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
GitBlit plugin for Gerrit Code Review
GitBlit plugin for Gerrit Code ReviewGitBlit plugin for Gerrit Code Review
GitBlit plugin for Gerrit Code Review
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with Git
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
 
Git Basics Philips
Git Basics PhilipsGit Basics Philips
Git Basics Philips
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Git'in on Windows
Git'in on WindowsGit'in on Windows
Git'in on Windows
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answers
 
Git internals
Git internalsGit internals
Git internals
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Flow
FlowFlow
Flow
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control system
 
Git'in in 15
Git'in in 15Git'in in 15
Git'in in 15
 

Andere mochten auch

.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developersmpvanwinkle
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAidan Casey
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developersDmitry Guyvoronsky
 
[Easy] How to use Evernote: Beginner's Guide
[Easy]  How to use Evernote: Beginner's Guide[Easy]  How to use Evernote: Beginner's Guide
[Easy] How to use Evernote: Beginner's GuideAna Uy
 
DATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AKDATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AKAlexey Kononenko
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android DeveloperEffectiveUI
 
Platform freelance ASP .NET / C#
Platform freelance ASP .NET / C# Platform freelance ASP .NET / C#
Platform freelance ASP .NET / C# Saâd Zerhouni
 

Andere mochten auch (8)

Evernote
EvernoteEvernote
Evernote
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developers
 
[Easy] How to use Evernote: Beginner's Guide
[Easy]  How to use Evernote: Beginner's Guide[Easy]  How to use Evernote: Beginner's Guide
[Easy] How to use Evernote: Beginner's Guide
 
DATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AKDATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AK
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
Platform freelance ASP .NET / C#
Platform freelance ASP .NET / C# Platform freelance ASP .NET / C#
Platform freelance ASP .NET / C#
 

Ähnlich wie Git for the Android Developer

Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android DevelopersTony Hillerson
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015mwrather
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideRaghavendraVattikuti1
 
Git简介
Git简介Git简介
Git简介clvrobj
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open SourceLorna Mitchell
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptxgdscuds
 

Ähnlich wie Git for the Android Developer (20)

Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Git简介
Git简介Git简介
Git简介
 
3 Git
3 Git3 Git
3 Git
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
 
Talk to git
Talk to gitTalk to git
Talk to git
 
Git-r-Done
Git-r-DoneGit-r-Done
Git-r-Done
 
Git and Github workshop
Git and Github workshopGit and Github workshop
Git and Github workshop
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
simple Git
simple Git simple Git
simple Git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 

Mehr von Effective

User Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsUser Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsEffective
 
Death of a Design: 5 Stages of Grief
Death of a Design: 5 Stages of GriefDeath of a Design: 5 Stages of Grief
Death of a Design: 5 Stages of GriefEffective
 
UX Design Process 101: Where to start with UX
UX Design Process 101: Where to start with UXUX Design Process 101: Where to start with UX
UX Design Process 101: Where to start with UXEffective
 
Give Them What They Want: Discovering Customer Need with Wearable Technology
Give Them What They Want: Discovering Customer Need with Wearable TechnologyGive Them What They Want: Discovering Customer Need with Wearable Technology
Give Them What They Want: Discovering Customer Need with Wearable TechnologyEffective
 
Common Innovation Myths (World Usability Day)
Common Innovation Myths (World Usability Day)Common Innovation Myths (World Usability Day)
Common Innovation Myths (World Usability Day)Effective
 
Introduction to UX
Introduction to UXIntroduction to UX
Introduction to UXEffective
 
2016 SXSW Measures for Justice Panel Picker Presentation
2016 SXSW Measures for Justice Panel Picker Presentation2016 SXSW Measures for Justice Panel Picker Presentation
2016 SXSW Measures for Justice Panel Picker PresentationEffective
 
Water For People UX Awards Submission
Water For People UX Awards SubmissionWater For People UX Awards Submission
Water For People UX Awards SubmissionEffective
 
Getting into the Game: How EA Put User Research into Practice
Getting into the Game: How EA Put User Research into PracticeGetting into the Game: How EA Put User Research into Practice
Getting into the Game: How EA Put User Research into PracticeEffective
 
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t Enough
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t EnoughScottrade and Understanding the Customer Journey: When Segmentation Isn’t Enough
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t EnoughEffective
 
A Blended Space for Heritage Storytelling
A Blended Space for Heritage StorytellingA Blended Space for Heritage Storytelling
A Blended Space for Heritage StorytellingEffective
 
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...Effective
 
Mobile Website Design: Responsive, Adaptive or Both?
Mobile Website Design: Responsive, Adaptive or Both?Mobile Website Design: Responsive, Adaptive or Both?
Mobile Website Design: Responsive, Adaptive or Both?Effective
 
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...Effective
 
Liferay and Water For People: From Data to Information
Liferay and Water For People: From Data to InformationLiferay and Water For People: From Data to Information
Liferay and Water For People: From Data to InformationEffective
 
The Rules of UX - Enterprise 2.0
The Rules of UX - Enterprise 2.0The Rules of UX - Enterprise 2.0
The Rules of UX - Enterprise 2.0Effective
 
Making Mobile Meaningful NY 2013
Making Mobile Meaningful NY 2013Making Mobile Meaningful NY 2013
Making Mobile Meaningful NY 2013Effective
 
Experience Driven Development - Future Insights Live 2013
Experience Driven Development - Future Insights Live 2013Experience Driven Development - Future Insights Live 2013
Experience Driven Development - Future Insights Live 2013Effective
 
SXSW 2013 Daily Recap - Sunday GoodxGlobal
SXSW 2013 Daily Recap - Sunday GoodxGlobalSXSW 2013 Daily Recap - Sunday GoodxGlobal
SXSW 2013 Daily Recap - Sunday GoodxGlobalEffective
 
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...Effective
 

Mehr von Effective (20)

User Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsUser Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your Needs
 
Death of a Design: 5 Stages of Grief
Death of a Design: 5 Stages of GriefDeath of a Design: 5 Stages of Grief
Death of a Design: 5 Stages of Grief
 
UX Design Process 101: Where to start with UX
UX Design Process 101: Where to start with UXUX Design Process 101: Where to start with UX
UX Design Process 101: Where to start with UX
 
Give Them What They Want: Discovering Customer Need with Wearable Technology
Give Them What They Want: Discovering Customer Need with Wearable TechnologyGive Them What They Want: Discovering Customer Need with Wearable Technology
Give Them What They Want: Discovering Customer Need with Wearable Technology
 
Common Innovation Myths (World Usability Day)
Common Innovation Myths (World Usability Day)Common Innovation Myths (World Usability Day)
Common Innovation Myths (World Usability Day)
 
Introduction to UX
Introduction to UXIntroduction to UX
Introduction to UX
 
2016 SXSW Measures for Justice Panel Picker Presentation
2016 SXSW Measures for Justice Panel Picker Presentation2016 SXSW Measures for Justice Panel Picker Presentation
2016 SXSW Measures for Justice Panel Picker Presentation
 
Water For People UX Awards Submission
Water For People UX Awards SubmissionWater For People UX Awards Submission
Water For People UX Awards Submission
 
Getting into the Game: How EA Put User Research into Practice
Getting into the Game: How EA Put User Research into PracticeGetting into the Game: How EA Put User Research into Practice
Getting into the Game: How EA Put User Research into Practice
 
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t Enough
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t EnoughScottrade and Understanding the Customer Journey: When Segmentation Isn’t Enough
Scottrade and Understanding the Customer Journey: When Segmentation Isn’t Enough
 
A Blended Space for Heritage Storytelling
A Blended Space for Heritage StorytellingA Blended Space for Heritage Storytelling
A Blended Space for Heritage Storytelling
 
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...
Using Behavioral Modeling to Engage Customers Throughout the Decision-Making ...
 
Mobile Website Design: Responsive, Adaptive or Both?
Mobile Website Design: Responsive, Adaptive or Both?Mobile Website Design: Responsive, Adaptive or Both?
Mobile Website Design: Responsive, Adaptive or Both?
 
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...
Integrated Thinking: The Answer to Enterprise IT’s Perpetual Struggle - Forre...
 
Liferay and Water For People: From Data to Information
Liferay and Water For People: From Data to InformationLiferay and Water For People: From Data to Information
Liferay and Water For People: From Data to Information
 
The Rules of UX - Enterprise 2.0
The Rules of UX - Enterprise 2.0The Rules of UX - Enterprise 2.0
The Rules of UX - Enterprise 2.0
 
Making Mobile Meaningful NY 2013
Making Mobile Meaningful NY 2013Making Mobile Meaningful NY 2013
Making Mobile Meaningful NY 2013
 
Experience Driven Development - Future Insights Live 2013
Experience Driven Development - Future Insights Live 2013Experience Driven Development - Future Insights Live 2013
Experience Driven Development - Future Insights Live 2013
 
SXSW 2013 Daily Recap - Sunday GoodxGlobal
SXSW 2013 Daily Recap - Sunday GoodxGlobalSXSW 2013 Daily Recap - Sunday GoodxGlobal
SXSW 2013 Daily Recap - Sunday GoodxGlobal
 
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...
The Human Interface: Making UX An Integral Part of Your Technology Buying Dec...
 

Kürzlich hochgeladen

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

Git for the Android Developer

  • 1. Git For the Android Developer AnDevCon 2011 : Tony Hillerson #AnDevCon #effectiveui http://www.slideshare.net/thillerson/scm-for-android-developers-using-git
  • 2. About Me • Worked with Android and Git for a few years now • O’Reilly Screencaster: Developing Android Applications • http://training.oreilly.com/androidapps/ • http://training.oreilly.com/androidapps2/ • Tech Reviewer:
  • 4. What’s a Git? A completely ignorant, childish person with no manners. - http://urbandictionary.com Linus Torvalds http://en.wikipedia.org/wiki/Linus_Torvalds
  • 5. What’s a Git? Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. - http://git-scm.com
  • 6. Getting Set Up on Mac • Homebrew - http://mxcl.github.com/homebrew/ • MacPorts - http://www.macports.org/
  • 7. Getting Set Up on Windows • msysgit -http://code.google.com/p/msysgit/ • Cygwin - http://www.cygwin.com/
  • 8. Getting Set Up on Linux • apt, etc - you probably know the drill
  • 9. Gooies! • Git Tower - http://git-tower.com M • Brother Bard’s GitX fork - Mac http://brotherbard.com/blog/2010/03/experimental-gitx-fork/ A C • Tortoise Git - http://code.google.com/p/tortoisegit/ W Mac I N
  • 11. Reference • Git - http://git-scm.com/ • ProGit - http://progit.org/book/ - Scott Chacon • Insider Guide to Github - http://www.pragprog.com/screencasts/ v-scgithub/insider-guide-to-github - Scott Chacon
  • 12. Note • Code may be in backticks: `git <command>` • Don’t input the backticks
  • 13. The Command Line A Short Sermon
  • 14. Seven Use Cases Where Git will Make your Life Easier
  • 15. Project History Git will Make your Life Easier
  • 16. Why Source Control • For the solo developer? • Protection against mistakes • Freedom • to refactor • to experiment • For the development team? • All of the above, plus: • Parallel development • Merging different code branches
  • 17. Simple Commands • `git init`- Creates an empty Git repository • .gitignore - tells git to ignore certain files • `git add` - Adds a file to the stage (“stages a file”) • `git rm` - Removes from version control • `git commit` - Commits the staged changes to the (local) repository • `git log` • `git add -i` Interactive Add
  • 18. git git or clone init git 86650c185eda50c9f9d58e2fbdf8b7113e5dee54 git commit changes add git git commit 6facfd9f34173f4fb024196996e948a87c85eb56 changes add git git commit b02ef5bf190e28ba24eab3ffab6133181cb5b5ef changes add ... ∞ Simple Workflow
  • 19. .gitignore • Can be nested deeply • https://github.com/github/gitignore • Use it! Contribute!
  • 20. Git Log - The Project’s History • What got committed? • Commit messages • Content • When? Who?
  • 21. What’s With all the Characters? 86650c185eda50c9f9d58e2fbdf8b7113e5dee54 • SHA1 Hash • Uniquely identifies a commit • Secure - very unlikely that someone can tamper with content in a repository “... to have a probability of a SHA1-hash collision rise to 1/2, you need about 10^24 objects ...” - Scott Chacon in Pro Git (paraphrased)
  • 22. Interactive Add - Building Commits • `git add` simply adds to the stage • `git commit -a` will commit all changes to tracked files (add and commit) • `git add -i` -- a command line tool to interactively add changes • Individual commits shouldn’t leave things broken • Try to commit some useful feature or bug fix all together
  • 23. Getting Out of Trouble Git will Make your Life Easier
  • 24. Advanced Commands • blame • checkout • commit -a • reset • stash • commit --amend • revert
  • 25. git blame • remember: git help blame • Who broke the build??? etc...
  • 26. git checkout, commit -a, reset • remember: git help reset • `git commit -a` = commit bypassing `git add` • `git checkout <filename>` = remove all unstaged changes • `git reset <filename>` = opposite of `git add <filename>` • `git reset HEAD` = same as above - acts on all changes • `git reset HEAD^` (also ^^, or ~1, ~42, etc.) = rollback commits to working tree • `git reset --soft` = rollback commit to stage
  • 27. git stash • remember: git help stash • Stash away changes in a safe place
  • 28. git commit --amend • Oops! I misspelled something in the commit message • Oops! I did `git commit -a` and forgot to `git add` a file • Oops! I just committed a bug • USE ONLY BEFORE YOU SHARE CHANGES
  • 29. git revert • Commits the reverse of a commit • The previous commit is still there • != svn revert
  • 30. Collaboration Git will Make your Life Easier
  • 31. Remotes • remote add • push • clone • pull • fetch
  • 32. Strategies • Star • Peer to Peer • Blessed Repository • Hierarchical
  • 33. Committer Committer Committer “The Committer Server” Committer Committer Star
  • 34. • ssh://user@computer:path/to/repo.git • http Peer • Gitosis • Gitolite Peer Peer Peer to N Peers
  • 35. Dictator ... etc. Maintains a “blessed repository” Lieutenant Lieutenant Developer Developer Developer Developer Hierarchical (Linux model)
  • 36. Topical Development Git will Make your Life Easier
  • 37. Branching • checkout -b • merging • Rebasing • cherry-pick
  • 38. How To Think About Branching • Topic Branches • Mainline • What do you want “master” to mean? • Branching examples
  • 39. Topic Branches • Branching is about controlling feature sets • Make a new branch for a story • Make a new branch for a bug fix • Make a new branch to spike something
  • 40. Team Branching Strategies • What do you want “master” to mean? • Keep master deployable? • one strategy for web software • Use “master” as an integration branch? • Each developer uses topic branches and integrates to master • Make a branch for releases
  • 41. Branching git checkout -b add_login_activity master Mac fb4f5d9 c5083fa add_login_activity Mac 9aa8827 fe594ce ccb6f5e
  • 42. Branching: Merging git checkout master git merge add_login_activity master Mac 9aa8827 fe594ce ccb6f5e fb4f5d9 c5083fa 3f43fa3 add_login_activity Mac 9aa8827 fe594ce ccb6f5e
  • 43. Branching: Rebasing master Mac fb4f5d9 c5083fa 3f43fa3 add_login_activity before Mac 9aa8827 fe594ce ccb6f5e master Mac fb4f5d9 c5083fa 3f43fa3 add_login_activit after Mac 9aa8827 fe594ce ccb6f5e `git rebase master`
  • 44. Branching: Rebasing • Better than merging • Don’t use if you’ve pushed your branch to a remote • Git will complain about refs • Can override with `git push -force` • Also available on `git pull --rebase` • Helpful for avoiding merge commits • May cause problems if git can’t automatically merge • `git reset HEAD` and start over with normal `git pull`
  • 45. Cherry-pick git cherry-pick fe594ce A new commit master with the changes from fe594ce Mac fb4f5d9 c5083fa 3f43fa3 add_login_activity Mac 9aa8827 fe594ce ccb6f5e
  • 46. Cherry Picking • Doesn’t add a reference to the old commit • Only applies the changes • Future merges should apply cleanly
  • 47. Release Management Git will Make your Life Easier
  • 49. Tagging git tag -a -m"Tagging v1.0" v1.0 c5083fa master Mac fb4f5d9 c5083fa 3f43fa3 • Both -v1.0 and c5083fa will point to c5083fa • Push this tag with `git push --tags` • Can be cryptologically signed
  • 50. Bug Fixing Git will Make your Life Easier
  • 52. Bisect git bisect start HEAD git bisect bad fb4f5d9 Mac c5083fa 3f43fa3 9aa8827 fe594ce ccb6f5e 2e531cb git bisect good fb4f5d9 HEAD fb4f5d9 Mac c5083fa 3f43fa3 9aa8827 fe594ce ccb6f5e 2e531cb git bisect good Git tells you this was the git bisect good first bad git bisect bad commit HEAD fb4f5d9 Mac c5083fa 3f43fa3 9aa8827 fe594ce ccb6f5e 2e531cb
  • 53. Open Source Code Git will Make your Life Easier
  • 54. Github.com • Search it! • Forking • Pull Requests
  • 55. Thank you! Git For the Android Developer AnDevCon 2011 : Tony Hillerson