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

More Related Content

What's hot

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
 

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

Viewers also liked

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
 

Viewers also liked (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#
 

Similar to .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
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek Jacoby
 

Similar to .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
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 

Recently uploaded

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
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...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

.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