SlideShare a Scribd company logo
1 of 55
Download to read offline
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

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

Grafittis, Lenguaje Urbano
Grafittis, Lenguaje UrbanoGrafittis, Lenguaje Urbano
Grafittis, Lenguaje Urbanonico552
 
NLRB report of the acting general counsel concerning social media cases
NLRB report of the acting general counsel concerning social media casesNLRB report of the acting general counsel concerning social media cases
NLRB report of the acting general counsel concerning social media casesElizabeth Lupfer
 
Placing Trust in Employee Engagement by Acas Council
Placing Trust in Employee Engagement by Acas CouncilPlacing Trust in Employee Engagement by Acas Council
Placing Trust in Employee Engagement by Acas CouncilElizabeth Lupfer
 
Mercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee EngagementMercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee EngagementElizabeth Lupfer
 
Contact Center Pipeline Drive Culture Improvement
Contact Center Pipeline Drive Culture ImprovementContact Center Pipeline Drive Culture Improvement
Contact Center Pipeline Drive Culture ImprovementElizabeth Lupfer
 
Qualigence Vs Competitors
Qualigence Vs CompetitorsQualigence Vs Competitors
Qualigence Vs CompetitorsSteve Lowisz
 
Top 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too LongTop 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too LongSusan Joy Schleef
 
Social Media In The Workplace
Social Media In The WorkplaceSocial Media In The Workplace
Social Media In The WorkplaceElizabeth Lupfer
 
Auto Presentation1
Auto Presentation1Auto Presentation1
Auto Presentation1guest0f5fd0
 
Podcasting In The Spanish Classroom
Podcasting In The Spanish ClassroomPodcasting In The Spanish Classroom
Podcasting In The Spanish ClassroomJason Noble
 

Viewers also liked (20)

Grafittis, Lenguaje Urbano
Grafittis, Lenguaje UrbanoGrafittis, Lenguaje Urbano
Grafittis, Lenguaje Urbano
 
NLRB report of the acting general counsel concerning social media cases
NLRB report of the acting general counsel concerning social media casesNLRB report of the acting general counsel concerning social media cases
NLRB report of the acting general counsel concerning social media cases
 
How To Present
How To PresentHow To Present
How To Present
 
The Talent Dialogue
The  Talent  DialogueThe  Talent  Dialogue
The Talent Dialogue
 
Ppt_Felicitacions Nadal
Ppt_Felicitacions NadalPpt_Felicitacions Nadal
Ppt_Felicitacions Nadal
 
Placing Trust in Employee Engagement by Acas Council
Placing Trust in Employee Engagement by Acas CouncilPlacing Trust in Employee Engagement by Acas Council
Placing Trust in Employee Engagement by Acas Council
 
PCM
PCMPCM
PCM
 
Mercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee EngagementMercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee Engagement
 
Holiday Greetings
Holiday GreetingsHoliday Greetings
Holiday Greetings
 
Contact Center Pipeline Drive Culture Improvement
Contact Center Pipeline Drive Culture ImprovementContact Center Pipeline Drive Culture Improvement
Contact Center Pipeline Drive Culture Improvement
 
Communicationppt
CommunicationpptCommunicationppt
Communicationppt
 
Qualigence Vs Competitors
Qualigence Vs CompetitorsQualigence Vs Competitors
Qualigence Vs Competitors
 
INRI CRISTO's Biography
INRI CRISTO's BiographyINRI CRISTO's Biography
INRI CRISTO's Biography
 
Top 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too LongTop 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too Long
 
Social Media In The Workplace
Social Media In The WorkplaceSocial Media In The Workplace
Social Media In The Workplace
 
Module03
Module03Module03
Module03
 
Vaccine Anticancer
Vaccine AnticancerVaccine Anticancer
Vaccine Anticancer
 
01
0101
01
 
Auto Presentation1
Auto Presentation1Auto Presentation1
Auto Presentation1
 
Podcasting In The Spanish Classroom
Podcasting In The Spanish ClassroomPodcasting In The Spanish Classroom
Podcasting In The Spanish Classroom
 

Similar to SCM for Android Developers Using Git

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
 

Similar to SCM for Android Developers Using Git (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
 

More from Tony Hillerson

Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)Tony Hillerson
 
Dynamic Sound for Android
Dynamic Sound for AndroidDynamic Sound for Android
Dynamic Sound for AndroidTony Hillerson
 
Designing an Android App from Idea to Market
Designing an Android App from Idea to MarketDesigning an Android App from Idea to Market
Designing an Android App from Idea to MarketTony Hillerson
 
First Android Experience
First Android ExperienceFirst Android Experience
First Android ExperienceTony Hillerson
 
iPhone Persistence For Mere Mortals
iPhone Persistence For Mere MortalsiPhone Persistence For Mere Mortals
iPhone Persistence For Mere MortalsTony Hillerson
 
Flex Framework Smackdown
Flex Framework SmackdownFlex Framework Smackdown
Flex Framework SmackdownTony Hillerson
 

More from Tony Hillerson (10)

Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Dynamic Sound for Android
Dynamic Sound for AndroidDynamic Sound for Android
Dynamic Sound for Android
 
Designing an Android App from Idea to Market
Designing an Android App from Idea to MarketDesigning an Android App from Idea to Market
Designing an Android App from Idea to Market
 
Rails on HBase
Rails on HBaseRails on HBase
Rails on HBase
 
Flex With Rubyamf
Flex With RubyamfFlex With Rubyamf
Flex With Rubyamf
 
First Android Experience
First Android ExperienceFirst Android Experience
First Android Experience
 
iPhone Persistence For Mere Mortals
iPhone Persistence For Mere MortalsiPhone Persistence For Mere Mortals
iPhone Persistence For Mere Mortals
 
Flex Framework Smackdown
Flex Framework SmackdownFlex Framework Smackdown
Flex Framework Smackdown
 
Flex And Rails
Flex And RailsFlex And Rails
Flex And Rails
 

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
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
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
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
 
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
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
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!
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
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
 

SCM for Android Developers Using Git

  • 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