SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
.Git Wah?
Everyting you wanted to know about .Git but were
                  afraid to ask?
Mike Van Winkle

• Developer @ WP Engine
• Freelance WordPress Developer for 3 years
• Second career
• Santa Rosa, CA
Utopia

• I write perfect code.
• I upload perfect code to website.
• Nobody touches my perfect code without
  asking me first.
• Rinse and Repeat.
Reality

• Other developers on a project
• I do stupid things
• Clients sometimes think they can code
• Shit happens
Version Control


• The Problem: How do we maintain stability
  and continuity in our websites/applications?
• The Answer: We save versions.
Realistic Workflow




   http://nvie.com/posts/a-successful-git-branching-model/
Realistic Workflow




   http://nvie.com/posts/a-successful-git-branching-model/
Version Control

• As much about transitioning a website
  between states as it is recording changes.
• Deployment is quicker and safer.
• Changes can be easily “rolled” back.
• A google example
Subversion or .Git

• SVN solves the problem by saving a
  “revision” with each change committed.
  Developers then can update code to a
  specific #
• Git Solves the problem by tracking the
  differences between commits
Subversion or .Git
• .Git is a “distributed” model with less
  server overhead and better performance
• .Git makes complex workflows much easier
  to manage
• Github.com is a great community of
  projects and developers sharing code.
• Little functions that make life easy
  (examples later)
Getting Started:What
      you need

• A command line tool like iTerm or Putty
• RSA Key Pair: https://help.github.com/articles/generating-ssh-keys




• Some Code
Getting Started: Set up
        a repo
Getting Started: Set up
        a repo
Getting Started:Then
       What?
$ git init
[create a .gitignore file ... touch .gitignore ]
$ git add . --all OR $ git add wp-content
$ git add remote origin
git@github.com:mikevanwinkle/My-WP-Site.git
git commit -am “initial commit”
git push origin master
What to ignore?
• Large Files
• Local Files
   • custom .htaccess files
   • custom wp-config.php
 • WP Core
 • Folders containing .svn info
 • Historic Files
What to ignore?
*~                    wp-content/upgrade/*         .htaccess ?
.svn                  wp-content/uploads           wp-config.php ?
.cvs                  wp-content/blogs.dir/*/*
.git                  pclzip-*
.listing              log.txt
*.bak                 debug.log
*.swp                 gallery/*
cache                 wp-content/gallery/*
.cache                wp-content/album/*
temp                  wp-content/plugins/plugins
tmp
*.tmp
imagecache*
uploads*
*_backup
wp-config-sample.php
wp-content/w3tc*
wp-content/w3-*
Deployment

On your webhost, you’ll need ssh access or you will
need a tool that can deploy via FTP ( Beanstalk ? )
$ git clone git@github.com:mikevanwinkle/My-WP-
Site.git
$ git pull origin master
Development: Example
[on your local]

$ git branch dev

$ git checkout dev

[make some changes]

$ git commit -am “Making my dev changes”

$ git push origin dev [pushes the new branch up]

[on production site]

$ git pull origin dev

$ git checkout dev
Development: Example
[on your local]

$ git branch feature-1

$ git checkout feature-1

[make some changes]

$ git commit -am “Making my dev changes”

$ git push origin feature-1 [pushes the new branch up]

$ git checkout master

$ git merge feature-1

$ git commit -am “merge feature-1 with master”

$ git push origin master
Realistic Workflow
Realistic Workflow
Cool Stuff: Hooks
•   applypatch-msg

•   post-commit

•   post-update

•   pre-commit

•   update

•   commit-msg

•   post-receive

•   pre-applypatch

•   pre-rebase
Cool Stuff: Stash
•   applypatch-msg

•   post-commit

•   post-update

•   pre-commit

•   update

•   commit-msg

•   post-receive

•   pre-applypatch

•   pre-rebase
Cool Stuff: Stash

$ git stash save “Temp 2”

$ git stash list

$ git stash apply <STASH ID>

http://git-scm.com/book/en/Git-Tools-Stashing
Cool Stuff: Reset


$ git reset --hard HEAD
Cool Stuff: Reset


$ git reset --hard HEAD
Cool Stuff: Archive


$ git archive HEAD | gzip > /tmp/
website.tar.gz
Resources

http://rkulla.blogspot.com/2011/08/some-points-on-git-vs-subversion.html

http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook/

http://git.wpengine.com/faq/

https://help.github.com/

http://git-scm.com/docs/git-merge

Weitere ähnliche Inhalte

Was ist angesagt?

Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7Chris Caple
 
Teaching a Designer to Use GitHub
Teaching a Designer to Use GitHubTeaching a Designer to Use GitHub
Teaching a Designer to Use GitHubLiam Dempsey
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHubPuppet
 
Why you can't ignore GitLab
Why you can't ignore GitLabWhy you can't ignore GitLab
Why you can't ignore GitLabPivorak MeetUp
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 
Save Time and Money with Automation
Save Time and Money with AutomationSave Time and Money with Automation
Save Time and Money with AutomationChris Jean
 
How we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyHow we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyMinqi Pan
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CIOlinData
 

Was ist angesagt? (19)

Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
 
Teaching a Designer to Use GitHub
Teaching a Designer to Use GitHubTeaching a Designer to Use GitHub
Teaching a Designer to Use GitHub
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHub
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
 
Why you can't ignore GitLab
Why you can't ignore GitLabWhy you can't ignore GitLab
Why you can't ignore GitLab
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Introducing Wordpress Multitenancy
Introducing Wordpress MultitenancyIntroducing Wordpress Multitenancy
Introducing Wordpress Multitenancy
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Save Time and Money with Automation
Save Time and Money with AutomationSave Time and Money with Automation
Save Time and Money with Automation
 
Jenkins with Heroku
Jenkins with HerokuJenkins with Heroku
Jenkins with Heroku
 
ConcourseCi Dockerimage
ConcourseCi DockerimageConcourseCi Dockerimage
ConcourseCi Dockerimage
 
How we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyHow we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee company
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
 
Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Blogging for hackers (english)
Blogging for hackers (english)Blogging for hackers (english)
Blogging for hackers (english)
 

Andere mochten auch

Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android DeveloperEffective
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAidan Casey
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android DevelopersTack Mobile
 
Git For The Android Developer
Git For The Android DeveloperGit For The Android Developer
Git For The Android DeveloperEffective
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAdam Culp
 
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 (11)

Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
Evernote
EvernoteEvernote
Evernote
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Git For The Android Developer
Git For The Android DeveloperGit For The Android Developer
Git For The Android Developer
 
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 WordPress Developers

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with gitJoseluis Laso
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubScott Graham
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
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
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...rtCamp
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitaminAlex Hillman
 
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)Mark Hamstra
 
Git ritesh venture_pact
Git ritesh venture_pactGit ritesh venture_pact
Git ritesh venture_pactriteshtandon23
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in UnityRifauddin Tsalitsy
 
Git Introductive
Git IntroductiveGit Introductive
Git IntroductiveAdham Saad
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek Jacoby
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 

Ähnlich wie .Git for WordPress Developers (20)

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git
GitGit
Git
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with git
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
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
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git ritesh venture_pact
Git ritesh venture_pactGit ritesh venture_pact
Git ritesh venture_pact
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
 
Git Heaven with Wakanda
Git Heaven with WakandaGit Heaven with Wakanda
Git Heaven with Wakanda
 
Git101
Git101Git101
Git101
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 

Kürzlich hochgeladen

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
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
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
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
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

.Git for WordPress Developers

  • 1. .Git Wah? Everyting you wanted to know about .Git but were afraid to ask?
  • 2. Mike Van Winkle • Developer @ WP Engine • Freelance WordPress Developer for 3 years • Second career • Santa Rosa, CA
  • 3. Utopia • I write perfect code. • I upload perfect code to website. • Nobody touches my perfect code without asking me first. • Rinse and Repeat.
  • 4. Reality • Other developers on a project • I do stupid things • Clients sometimes think they can code • Shit happens
  • 5. Version Control • The Problem: How do we maintain stability and continuity in our websites/applications? • The Answer: We save versions.
  • 6. Realistic Workflow http://nvie.com/posts/a-successful-git-branching-model/
  • 7. Realistic Workflow http://nvie.com/posts/a-successful-git-branching-model/
  • 8. Version Control • As much about transitioning a website between states as it is recording changes. • Deployment is quicker and safer. • Changes can be easily “rolled” back. • A google example
  • 9. Subversion or .Git • SVN solves the problem by saving a “revision” with each change committed. Developers then can update code to a specific # • Git Solves the problem by tracking the differences between commits
  • 10. Subversion or .Git • .Git is a “distributed” model with less server overhead and better performance • .Git makes complex workflows much easier to manage • Github.com is a great community of projects and developers sharing code. • Little functions that make life easy (examples later)
  • 11. Getting Started:What you need • A command line tool like iTerm or Putty • RSA Key Pair: https://help.github.com/articles/generating-ssh-keys • Some Code
  • 12. Getting Started: Set up a repo
  • 13. Getting Started: Set up a repo
  • 14. Getting Started:Then What? $ git init [create a .gitignore file ... touch .gitignore ] $ git add . --all OR $ git add wp-content $ git add remote origin git@github.com:mikevanwinkle/My-WP-Site.git git commit -am “initial commit” git push origin master
  • 15. What to ignore? • Large Files • Local Files • custom .htaccess files • custom wp-config.php • WP Core • Folders containing .svn info • Historic Files
  • 16. What to ignore? *~ wp-content/upgrade/* .htaccess ? .svn wp-content/uploads wp-config.php ? .cvs wp-content/blogs.dir/*/* .git pclzip-* .listing log.txt *.bak debug.log *.swp gallery/* cache wp-content/gallery/* .cache wp-content/album/* temp wp-content/plugins/plugins tmp *.tmp imagecache* uploads* *_backup wp-config-sample.php wp-content/w3tc* wp-content/w3-*
  • 17. Deployment On your webhost, you’ll need ssh access or you will need a tool that can deploy via FTP ( Beanstalk ? ) $ git clone git@github.com:mikevanwinkle/My-WP- Site.git $ git pull origin master
  • 18. Development: Example [on your local] $ git branch dev $ git checkout dev [make some changes] $ git commit -am “Making my dev changes” $ git push origin dev [pushes the new branch up] [on production site] $ git pull origin dev $ git checkout dev
  • 19. Development: Example [on your local] $ git branch feature-1 $ git checkout feature-1 [make some changes] $ git commit -am “Making my dev changes” $ git push origin feature-1 [pushes the new branch up] $ git checkout master $ git merge feature-1 $ git commit -am “merge feature-1 with master” $ git push origin master
  • 22. Cool Stuff: Hooks • applypatch-msg • post-commit • post-update • pre-commit • update • commit-msg • post-receive • pre-applypatch • pre-rebase
  • 23. Cool Stuff: Stash • applypatch-msg • post-commit • post-update • pre-commit • update • commit-msg • post-receive • pre-applypatch • pre-rebase
  • 24. Cool Stuff: Stash $ git stash save “Temp 2” $ git stash list $ git stash apply <STASH ID> http://git-scm.com/book/en/Git-Tools-Stashing
  • 25. Cool Stuff: Reset $ git reset --hard HEAD
  • 26. Cool Stuff: Reset $ git reset --hard HEAD
  • 27. Cool Stuff: Archive $ git archive HEAD | gzip > /tmp/ website.tar.gz