Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Being a Git

Jenny Wong
November 20, 2013

Being a Git

Talk given at MWUG re Git

Jenny Wong

November 20, 2013
Tweet

More Decks by Jenny Wong

Other Decks in Technology

Transcript

  1. www.reasondigital.com @miss_jwo wikipedia.org/wiki/Revision_control Version control is the ! management of

    changes ! to documents, computer programs, large web sites, and other collections of information.
  2. www.reasondigital.com @miss_jwo commonly refers to a storage location, often for

    safety or preservation. ! Default: origin Repository (repo)
  3. www.reasondigital.com @miss_jwo “ I’m an egotistical bastard, and I name

    all my projects after myself. First Linux, now git. ” Linus Torvalds
  4. www.reasondigital.com @miss_jwo 1. Create a new project 2. Add files

    to the project 3. Check what changes have happened 4. Write a comment saying where the project is up to ! ! Scenario: New Project on your own machine.
  5. www.reasondigital.com @miss_jwo 2. Add files to the project create a

    file inside the MWUG repo git add fileName MWUG
  6. www.reasondigital.com @miss_jwo 2. Add files to the project create a

    file inside the MWUG repo git add fileName MWUG git add -a
  7. www.reasondigital.com @miss_jwo 2. Add files to the project create a

    file inside the MWUG repo git add fileName MWUG git add -a Pay attention to changes in this file {
  8. www.reasondigital.com @miss_jwo 4. Write a comment saying where the project

    is up to git commit MWUG “Changed body background to yellow” { Log File }
  9. www.reasondigital.com @miss_jwo A duplication of the project within the same

    repository. Enables the ability of code changes to be self contained. ! Default: Master Branch
  10. www.reasondigital.com @miss_jwo 1. Make a version of the project 2.

    Make changes the project 3. Client agrees to the changes 4. Copy the changes to the master copy of the site ! ! Scenario: Client wants multiple extra features
  11. www.reasondigital.com @miss_jwo 1. Create a version of the project create

    a branch for the new feature MWUG master { default
  12. www.reasondigital.com @miss_jwo 1. Create a version of the project create

    a branch for the new feature git checkout -b newFeature MWUG newFeature master { default
  13. www.reasondigital.com @miss_jwo 4. Copy the changes to the master copy

    of the site newFeature master feature1 feature2
  14. www.reasondigital.com @miss_jwo 4. Copy the changes to the master copy

    of the site git checkout master git merge newFeature newFeature master feature1 feature2 Go to location you want the changes Copy in the changes from newFeature branch {
  15. www.reasondigital.com @miss_jwo What about changes in Master? newFeature master feature1

    feature2 git checkout newFeature git merge Master Go to location you want the changes Copy in the changes from Master branch {
  16. www.reasondigital.com @miss_jwo The action of duplicating a repository in it’s

    entirety at a certain point in time. Fork / Clone a project
  17. www.reasondigital.com @miss_jwo 1. Get a copy of project 2. Make

    changes on the project 3. Make a note of changes 4. Send a copy of the changes back to original machine ! ! Scenario: Work on a different machine
  18. www.reasondigital.com @miss_jwo Photocopy of the project from a particular location

    MWUG @ Origin MWUG @ HomePC git clone originLocation/MWUG /MWUG 1. Get a copy of project
  19. www.reasondigital.com @miss_jwo Select which branch of the repo you want

    to work on { MWUG @ HomePC 2. Make changes on the project
  20. www.reasondigital.com @miss_jwo Select which branch of the repo you want

    to work on { MWUG @ HomePC git checkout newFeature 2. Make changes on the project
  21. www.reasondigital.com @miss_jwo Select which branch of the repo you want

    to work on { MWUG @ HomePC git checkout newFeature 2. Make changes on the project
  22. www.reasondigital.com @miss_jwo Logging what you have done on this branch

    { MWUG @ HomePC git commit 3. Make a note of changes
  23. www.reasondigital.com @miss_jwo Send changes to different remote { MWUG @

    Origin 4. Send a copy of the changes back to original machine MWUG @ HomePC
  24. www.reasondigital.com @miss_jwo Send changes to different remote { MWUG @

    Origin git push origin newFeature 4. Send a copy of the changes back to original machine MWUG @ HomePC
  25. www.reasondigital.com @miss_jwo Bring in changes from different remote { MWUG

    @ Origin What about changes on the original machine? MWUG @ HomePC
  26. www.reasondigital.com @miss_jwo Bring in changes from different remote { MWUG

    @ Origin git pull origin newFeature What about changes on the original machine? MWUG @ HomePC