SlideShare a Scribd company logo
.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

PPTX
Using Git to Organize Your Project
PPTX
Introduction to bower
PDF
Intro to Github Actions @likecoin
PPTX
Github basics
PDF
My Top 5 Favorite Gems
PDF
Using a Private Git Server for Packaging Software
PPTX
Basic Git commands
PDF
Concourse updates
Using Git to Organize Your Project
Introduction to bower
Intro to Github Actions @likecoin
Github basics
My Top 5 Favorite Gems
Using a Private Git Server for Packaging Software
Basic Git commands
Concourse updates

What's hot (19)

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

Viewers also liked (11)

PDF
Git for the Android Developer
PPTX
Evernote
PPTX
Essential git for developers
PDF
Git for Android Developers
PDF
Git For The Android Developer
PDF
Essential git for developers
PPT
Introduction to Git for developers
PDF
[Easy] How to use Evernote: Beginner's Guide
PDF
DATAS Technolody may2016 eng AK
PDF
Git for the Android Developer
PDF
Platform freelance ASP .NET / C#
Git for the Android Developer
Evernote
Essential git for developers
Git for Android Developers
Git For The Android Developer
Essential git for developers
Introduction to Git for developers
[Easy] How to use Evernote: Beginner's Guide
DATAS Technolody may2016 eng AK
Git for the Android Developer
Platform freelance ASP .NET / C#
Ad

Similar to .Git for WordPress Developers (20)

KEY
Git Distributed Version Control System
PPTX
PPT
Git installation and configuration
PDF
Collaborative development with git
PPT
Open up your platform with Open Source and GitHub
PPT
Git 101 - Crash Course in Version Control using Git
PDF
Switching to Git
PDF
The Basics of Open Source Collaboration With Git and GitHub
PDF
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
PPTX
Git-guidance for beginner- IT support.pptx.pptx
PPTX
Git-guidance for beginner- IT support.pptx
PPT
Version Control ThinkVitamin
PDF
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
PDF
Wokshop de Git
PPTX
Git ritesh venture_pact
PPTX
Working in Team using Git in Unity
PPTX
Git Introductive
PPT
Git Heaven with Wakanda
PPTX
Introduction To Git Workshop
PPTX
Untangling fall2017 week2
Git Distributed Version Control System
Git installation and configuration
Collaborative development with git
Open up your platform with Open Source and GitHub
Git 101 - Crash Course in Version Control using Git
Switching to Git
The Basics of Open Source Collaboration With Git and GitHub
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Git-guidance for beginner- IT support.pptx.pptx
Git-guidance for beginner- IT support.pptx
Version Control ThinkVitamin
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Wokshop de Git
Git ritesh venture_pact
Working in Team using Git in Unity
Git Introductive
Git Heaven with Wakanda
Introduction To Git Workshop
Untangling fall2017 week2

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Machine Learning_overview_presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Weekly Chronicles - August'25-Week II
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
MIND Revenue Release Quarter 2 2025 Press Release
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine Learning_overview_presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
sap open course for s4hana steps from ECC to s4
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf

.Git for WordPress Developers