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?

Save Time and Money with Automation
Save Time and Money with AutomationSave Time and Money with Automation
Save Time and Money with Automation
Chris Jean
 

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 Developer
Effective
 
DATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AKDATAS Technolody may2016 eng AK
DATAS Technolody may2016 eng AK
Alexey Kononenko
 

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 System
Victor Wong
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
Adham Saad
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek 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
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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)
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation 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
 
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...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
+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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

.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