SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
Git, Github and Open Source
About Me

 • Lorna Jane Mitchell

 • Consultant, author, speaker

 • Github: http://github.com/lornajane

 • Twitter: @lornajane

 • Web: http://lornajane.net

 • Project lead of joind.in, open source project




                                                   2
Github

"We make it easier to collaborate with others and share your projects with
the universe"


   • Github is a hosted source control solution, based on git.

   • Used by open source projects, personal projects

   • Paid-for offerings for non-public code


There are other ways to do git, open source, and probably everything
mentioned here ...




                                                                             3
Centralised Version Control

The overall ecosystem with git looks different because instead of this:




                                  repo



      checkout                 checkout                  checkout




                                                                          4
Distributed Version Control

Things look like this:




                                repo


            repo         repo          repo   repo




                                                     5
Distributed Version Control

Or rather:




                     repo

                            repo

              repo

                                   repo

                     repo


                                          6
Code on GitHub
Get a Repo

 • Find the project

 • Fork the project

 • Clone your repo




                      8
Fork the Project




                   9
Clone your Repo




git clone git@github.com:username/joindin.git




                                                10
Git: Many Repos


                  GitHub

             joindin/joind.in

                     fork


            your-user/joind.in


                                clone

                            development
                                          11
Working with Git
Git Overview

A few key commands you will need:

  • git log and git show

  • git status and git diff

  • git add

  • git commit

  • git pull and git push

  • reverting changes


Then we’ll talk about branching




                                    13
Git Log

Git automatically sends the output to a pager like less


commit 76916fed387d9161d48b0f1e592685c183e4757c
Author: Lorna Mitchell <lorna@lornajane.net>
Date:   Wed Mar 14 21:06:24 2012 +0000

    adding the actual announcement wording to the banner

commit 3fdc9f6b9795ed6a3a02465817bfebb8f77ca34e
Author: Kim Rowan <rowan02@unknown-00-25-00-44-3a-04.home>
Date:   Tue Mar 13 12:58:48 2012 +0000

    Added info block to main page announcing php|arch Impact Award nom

commit dc5777199aa2bb822b498ec1dea99f3e89ee90e0
Author: Lorna Mitchell <lorna@lornajane.net>
Date:   Sun Mar 11 21:03:13 2012 +0000

    removed some unused files

                                                                   14
Git Log

There are some alternative views, this is git log -graph -oneline
* 76916fe adding the actual announcement wording to the banner
* 3fdc9f6 Added info block to main page announcing php|arch Impact Awa
* dc57771 removed some unused files
* aa502ec straightening out a problem with API metadata not showing up
* 6719b8a GH #473: Refactored ternary to if
*    d6a69d7 Merge branch 'joindin-167'
|
| * b7effc5 JOINDIN-167: Facebook users without username (this is poss
* | 6af9450 JOINDIN-167: reverted removal of facebook login
* |    6249401 Merge branch 'master' of https://github.com/joindin/join
| 
| |/
|/|
| *    16b31d3 Merge remote-tracking branch 'lornajane/no-facebook'
| |
| | * 36ee9ea removing facebook login functionality - hopefully tempor
| * | f4a2a73 removing references to the gravatar cache; these are ser
| |/
| * 83d6c04 Prevented forwarding on to anywhere except this site after
| *    d411358 Merge remote-tracking branch 'mvriel/JOINDIN-161_2'
                                                                    15
Git Status

Shows you what you have changed, and what will be in your next commit
(these are two different things)

After editing a couple of files:

# On branch impact-banner
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working dir
#
#       modified:   src/.htaccess
#       modified:   src/system/application/views/main/index.php
#
no changes added to commit (use "git add" and/or "git commit -a")


To include changes in a commit, we need to stage them first using
monogit add


                                                                        16
Git Add


git add src/system/application/views/main/index.php


git status again
# On branch impact-banner
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   src/system/application/views/main/index.php
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working dir
#
#       modified:   src/.htaccess
#




                                                                   17
Git Commit

git commit -m ’meaningful commit message’

  • Without the -m, git will open your default text editor to add a message

  • You can also supply a list of files to include in the commit

  • Use git add -interactive to stage sections of files




                                                                              18
Undoing Changes

To undo changes that you haven’t staged yet:

        git checkout -- path/to/file


If you have staged the changes, you can still undo them:

        git reset
        git reset --hard

Reset will unstage the changes; the hard reset puts everything back to the
most recent commit




                                                                             19
Managing the Multiple Repositories
Stay in Sync

Pull the changes from upstream into your local repo



               GitHub

          changes upstream



           your-user/joind.in               pull



                                        development


git pull upstream master

                                                      21
Stay in Sync

The changes are now in your local repo, push them to github:



                  GitHub

             changes upstream



              your-user/joind.in


                                   push

                                      changes locally


git push                                                       22
Branching in Git

What you need to know:

  • Branching (and merging!) are fast and painless




                                                     23
Branching in Git

What you need to know:

  • Branching (and merging!) are fast and painless

  • Branches are private by default




                                                     23
Branching in Git

What you need to know:

  • Branching (and merging!) are fast and painless

  • Branches are private by default

  • Branches are in the repo, they are not copies

      • no updating vhosts
      • only one directory with code in




                                                     23
Git Branching Commands

Create a new branch:

git checkout -b new-branch-name


Switch to an existing branch

git checkout branchname


List branches in this repo

git branch

Branches are local by default, they don’t synchronise to other repositories
unless asked




                                                                              24
Best Practice in Branching

Git doesn’t dictate a process, so usually each project does. Common
features:

  • Branch for features

  • Branch for fixes

  • Branch for experiments




                                                                      25
Best Practice in Branching

Git doesn’t dictate a process, so usually each project does. Common
features:

  • Branch for features

  • Branch for fixes

  • Branch for experiments

  • Basically: branch!

By keeping changes in branches, they are very easy to merge to another
repo or branch




                                                                         25
Sharing Changes

Your changes are in your local branch - how do they get into a main
project?




                  GitHub

                joindin/joind.in



              your-user/joind.in


                                        local feature


                                                                      26
Sharing Changes

git push origin new-branch-name




              GitHub

           joindin/joind.in



           feature at origin


                               push

                                      local feature


                                                      27
Sharing Changes

To offer changes upstream, make a pull request




                  GitHub

               joindin/joind.in

          pull request


               feature at origin



                                      local feature


                                                      28
Making a Pull Request

Make the pull request on GitHub




Explain what you have changed, and why. Keep changes atomic.
                                                               29
Open Source Contributions

After that:

   • Your pull request appears on the project’s list

        • http://github.com/joindin/joind.in/pulls

   • Hopefully it gets merged

   • You get bragging rights :)

        • https://github.com/joindin/joind.in/contributors




                                                             30
Where to Begin with Open Source

How to get involved: (warning, contains bias!)

   • Check for introductory docs

       • http://joind.in/about




                                                 31
Where to Begin with Open Source

How to get involved: (warning, contains bias!)

   • Check for introductory docs

       • http://joind.in/about

   • Get code and set up the project

       • usually, fork the repo and read the README




                                                      31
Where to Begin with Open Source

How to get involved: (warning, contains bias!)

   • Check for introductory docs

       • http://joind.in/about

   • Get code and set up the project

       • usually, fork the repo and read the README

   • Find the bug tracker, and pick something

       • http://joindin.jira.com




                                                      31
Where to Begin with Open Source

How to get involved: (warning, contains bias!)

   • Check for introductory docs

       • http://joind.in/about

   • Get code and set up the project

       • usually, fork the repo and read the README

   • Find the bug tracker, and pick something

       • http://joindin.jira.com

   • Talk to the other people in the project

       • #joind.in on freenode


                                                      31
Where to Begin with Open Source

How to get involved: (warning, contains bias!)

   • Check for introductory docs

       • http://joind.in/about

   • Get code and set up the project

       • usually, fork the repo and read the README

   • Find the bug tracker, and pick something

       • http://joindin.jira.com

   • Talk to the other people in the project

       • #joind.in on freenode

   • Share and enjoy
                                                      31
Questions?
Thanks!

  • Slides will be on slideshare

  • Github: http://github.com/lornajane

  • Twitter: @lornajane

  • Web: http://lornajane.net


PHPNW - 3rd April, Derick Rethans on MongoDB. Rain Bar, Manchester.




                                                                      33

Mais conteúdo relacionado

Mais procurados

Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHubUri Goldstein
 
Inside GitHub
Inside GitHubInside GitHub
Inside GitHuberr
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Simplilearn
 
Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHubMichael Redlich
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and GithubHouari ZEGAI
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHubDSCVSSUT
 
Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash courseMireia Sangalo
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubGDSCIIITBbsr
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administrationShawn Doyle
 

Mais procurados (20)

Github basics
Github basicsGithub basics
Github basics
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Inside GitHub
Inside GitHubInside GitHub
Inside GitHub
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
git and github
git and githubgit and github
git and github
 
Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHub
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash course
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Git tutorial
Git tutorial Git tutorial
Git tutorial
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Git 101
Git 101Git 101
Git 101
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Git basic
Git basicGit basic
Git basic
 
Git101
Git101Git101
Git101
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 

Destaque

Destaque (8)

Git/GitHub
Git/GitHubGit/GitHub
Git/GitHub
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
 

Semelhante a Git, GitHub and Open Source

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
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
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
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptxgdscuds
 
Git Workflow
Git WorkflowGit Workflow
Git WorkflowGary Yeh
 
Git for uninitiated
Git for uninitiatedGit for uninitiated
Git for uninitiatedJohn C. Chan
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testersupadhyay_25
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answersDeepQuest Software
 

Semelhante a Git, GitHub and Open Source (20)

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
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to 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
 
Day 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptxDay 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptx
 
Advance workshop on git
Advance workshop on gitAdvance workshop on git
Advance workshop on git
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 
Git Workflow
Git WorkflowGit Workflow
Git Workflow
 
Git for uninitiated
Git for uninitiatedGit for uninitiated
Git for uninitiated
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Git overview
Git overviewGit overview
Git overview
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Github
GithubGithub
Github
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answers
 
Git training v10
Git training v10Git training v10
Git training v10
 

Mais de Lorna Mitchell

Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API DesignLorna Mitchell
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyLorna Mitchell
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knewLorna Mitchell
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Lorna Mitchell
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP StackLorna Mitchell
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source ControlLorna Mitchell
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service DesignLorna Mitchell
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishLorna Mitchell
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHPLorna Mitchell
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHPLorna Mitchell
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?Lorna Mitchell
 

Mais de Lorna Mitchell (20)

OAuth: Trust Issues
OAuth: Trust IssuesOAuth: Trust Issues
OAuth: Trust Issues
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API Design
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and Money
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knew
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Join In With Joind.In
Join In With Joind.InJoin In With Joind.In
Join In With Joind.In
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Going Freelance
Going FreelanceGoing Freelance
Going Freelance
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source Control
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service Design
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To Fish
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Example Presentation
Example PresentationExample Presentation
Example Presentation
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Git, GitHub and Open Source

  • 1. Git, Github and Open Source
  • 2. About Me • Lorna Jane Mitchell • Consultant, author, speaker • Github: http://github.com/lornajane • Twitter: @lornajane • Web: http://lornajane.net • Project lead of joind.in, open source project 2
  • 3. Github "We make it easier to collaborate with others and share your projects with the universe" • Github is a hosted source control solution, based on git. • Used by open source projects, personal projects • Paid-for offerings for non-public code There are other ways to do git, open source, and probably everything mentioned here ... 3
  • 4. Centralised Version Control The overall ecosystem with git looks different because instead of this: repo checkout checkout checkout 4
  • 5. Distributed Version Control Things look like this: repo repo repo repo repo 5
  • 6. Distributed Version Control Or rather: repo repo repo repo repo 6
  • 8. Get a Repo • Find the project • Fork the project • Clone your repo 8
  • 10. Clone your Repo git clone git@github.com:username/joindin.git 10
  • 11. Git: Many Repos GitHub joindin/joind.in fork your-user/joind.in clone development 11
  • 13. Git Overview A few key commands you will need: • git log and git show • git status and git diff • git add • git commit • git pull and git push • reverting changes Then we’ll talk about branching 13
  • 14. Git Log Git automatically sends the output to a pager like less commit 76916fed387d9161d48b0f1e592685c183e4757c Author: Lorna Mitchell <lorna@lornajane.net> Date: Wed Mar 14 21:06:24 2012 +0000 adding the actual announcement wording to the banner commit 3fdc9f6b9795ed6a3a02465817bfebb8f77ca34e Author: Kim Rowan <rowan02@unknown-00-25-00-44-3a-04.home> Date: Tue Mar 13 12:58:48 2012 +0000 Added info block to main page announcing php|arch Impact Award nom commit dc5777199aa2bb822b498ec1dea99f3e89ee90e0 Author: Lorna Mitchell <lorna@lornajane.net> Date: Sun Mar 11 21:03:13 2012 +0000 removed some unused files 14
  • 15. Git Log There are some alternative views, this is git log -graph -oneline * 76916fe adding the actual announcement wording to the banner * 3fdc9f6 Added info block to main page announcing php|arch Impact Awa * dc57771 removed some unused files * aa502ec straightening out a problem with API metadata not showing up * 6719b8a GH #473: Refactored ternary to if * d6a69d7 Merge branch 'joindin-167' | | * b7effc5 JOINDIN-167: Facebook users without username (this is poss * | 6af9450 JOINDIN-167: reverted removal of facebook login * | 6249401 Merge branch 'master' of https://github.com/joindin/join | | |/ |/| | * 16b31d3 Merge remote-tracking branch 'lornajane/no-facebook' | | | | * 36ee9ea removing facebook login functionality - hopefully tempor | * | f4a2a73 removing references to the gravatar cache; these are ser | |/ | * 83d6c04 Prevented forwarding on to anywhere except this site after | * d411358 Merge remote-tracking branch 'mvriel/JOINDIN-161_2' 15
  • 16. Git Status Shows you what you have changed, and what will be in your next commit (these are two different things) After editing a couple of files: # On branch impact-banner # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working dir # # modified: src/.htaccess # modified: src/system/application/views/main/index.php # no changes added to commit (use "git add" and/or "git commit -a") To include changes in a commit, we need to stage them first using monogit add 16
  • 17. Git Add git add src/system/application/views/main/index.php git status again # On branch impact-banner # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: src/system/application/views/main/index.php # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working dir # # modified: src/.htaccess # 17
  • 18. Git Commit git commit -m ’meaningful commit message’ • Without the -m, git will open your default text editor to add a message • You can also supply a list of files to include in the commit • Use git add -interactive to stage sections of files 18
  • 19. Undoing Changes To undo changes that you haven’t staged yet: git checkout -- path/to/file If you have staged the changes, you can still undo them: git reset git reset --hard Reset will unstage the changes; the hard reset puts everything back to the most recent commit 19
  • 20. Managing the Multiple Repositories
  • 21. Stay in Sync Pull the changes from upstream into your local repo GitHub changes upstream your-user/joind.in pull development git pull upstream master 21
  • 22. Stay in Sync The changes are now in your local repo, push them to github: GitHub changes upstream your-user/joind.in push changes locally git push 22
  • 23. Branching in Git What you need to know: • Branching (and merging!) are fast and painless 23
  • 24. Branching in Git What you need to know: • Branching (and merging!) are fast and painless • Branches are private by default 23
  • 25. Branching in Git What you need to know: • Branching (and merging!) are fast and painless • Branches are private by default • Branches are in the repo, they are not copies • no updating vhosts • only one directory with code in 23
  • 26. Git Branching Commands Create a new branch: git checkout -b new-branch-name Switch to an existing branch git checkout branchname List branches in this repo git branch Branches are local by default, they don’t synchronise to other repositories unless asked 24
  • 27. Best Practice in Branching Git doesn’t dictate a process, so usually each project does. Common features: • Branch for features • Branch for fixes • Branch for experiments 25
  • 28. Best Practice in Branching Git doesn’t dictate a process, so usually each project does. Common features: • Branch for features • Branch for fixes • Branch for experiments • Basically: branch! By keeping changes in branches, they are very easy to merge to another repo or branch 25
  • 29. Sharing Changes Your changes are in your local branch - how do they get into a main project? GitHub joindin/joind.in your-user/joind.in local feature 26
  • 30. Sharing Changes git push origin new-branch-name GitHub joindin/joind.in feature at origin push local feature 27
  • 31. Sharing Changes To offer changes upstream, make a pull request GitHub joindin/joind.in pull request feature at origin local feature 28
  • 32. Making a Pull Request Make the pull request on GitHub Explain what you have changed, and why. Keep changes atomic. 29
  • 33. Open Source Contributions After that: • Your pull request appears on the project’s list • http://github.com/joindin/joind.in/pulls • Hopefully it gets merged • You get bragging rights :) • https://github.com/joindin/joind.in/contributors 30
  • 34. Where to Begin with Open Source How to get involved: (warning, contains bias!) • Check for introductory docs • http://joind.in/about 31
  • 35. Where to Begin with Open Source How to get involved: (warning, contains bias!) • Check for introductory docs • http://joind.in/about • Get code and set up the project • usually, fork the repo and read the README 31
  • 36. Where to Begin with Open Source How to get involved: (warning, contains bias!) • Check for introductory docs • http://joind.in/about • Get code and set up the project • usually, fork the repo and read the README • Find the bug tracker, and pick something • http://joindin.jira.com 31
  • 37. Where to Begin with Open Source How to get involved: (warning, contains bias!) • Check for introductory docs • http://joind.in/about • Get code and set up the project • usually, fork the repo and read the README • Find the bug tracker, and pick something • http://joindin.jira.com • Talk to the other people in the project • #joind.in on freenode 31
  • 38. Where to Begin with Open Source How to get involved: (warning, contains bias!) • Check for introductory docs • http://joind.in/about • Get code and set up the project • usually, fork the repo and read the README • Find the bug tracker, and pick something • http://joindin.jira.com • Talk to the other people in the project • #joind.in on freenode • Share and enjoy 31
  • 40. Thanks! • Slides will be on slideshare • Github: http://github.com/lornajane • Twitter: @lornajane • Web: http://lornajane.net PHPNW - 3rd April, Derick Rethans on MongoDB. Rain Bar, Manchester. 33