SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
Adding Source
Control to your
Life
Mark Kelnar
2013
Sunday, May 19, 13
Adding Source Control To Your Life
Who is this guy?
Mark Kelnar
WP Engine - lead developer
@renderandserve
github.com/markkelnar
Sunday, May 19, 13
HTML
JavaScript
CSS
PHP
Java, C/C++, Python
Ruby on Rails, Perl, bash
etc.
Adding Source Control To Your Life
Do you use any of these?
Sunday, May 19, 13
Adding Source Control To Your Life
Words worth remembering
init
clone
checkout
branch
fetch
diff
commit
pull
push
revert
Sunday, May 19, 13
Coding without source control is like ...
Adding Source Control To Your Life
photographer Emily West (Courtney)
Sunday, May 19, 13
Pick a version control system
git, subversion (svn), cvs, mercurial, and many more
Adding Source Control To Your Life
Sunday, May 19, 13
What do I do with it?
Adding Source Control To Your Life
domain.comlaptop / dev
New header
Sidebar widget
Facebook feed
importer
Work on different project/features,
switch between them seamlessly,
merge them together without missing anything
Sunday, May 19, 13
Adding github.com and staging branch
Adding Source Control To Your Life
laptop / dev
New header
Sidebar widget
Really cool
facebook thingy
laptop / dev
github repo
pull requests
branches
staging server
branch testing
git pull
production server
branch
git pull
pull/push
pull/push
pull
pull
Sunday, May 19, 13
Because you want to work
with other smart people
who can help.
Adding Source Control To Your Life
Sunday, May 19, 13
Create local repo
Adding Source Control To Your Life
Let’s talk about a simple example, local repo
http://git-scm.com/downloads
Sunday, May 19, 13
Create local repo
Adding Source Control To Your Life
Sunday, May 19, 13
Learn to branch
git checkout master
git checkout -b some-new-feature
<edit files>
git status
git diff
git commit -a -m ‘Edit theme for new cool feature’
<another edit>
git commit -a -m ‘Forgot the blue border’
Adding Source Control To Your Life
* Don’t commit it to production unless it’s ready to go live
Example:
Sunday, May 19, 13
Diff then Commit
Adding Source Control To Your Life
Sunday, May 19, 13
Merge branch back into main branch
Adding Source Control To Your Life
Sunday, May 19, 13
Adding Source Control To Your Life
Questions so far?
Sunday, May 19, 13
Push to remote using ssh
Here are two ways
A) push to a bare repo on server then pull to another working non-bare repo
Or B) push from local branch to a branch on non-bare repo then merge that branch into checked out /
production branch.
B) Initial setup
ssh me@server.com
cd /var/www/html/
git init domain.com
- at this point has no working branches, not even master. Only after initial push below
On local - one time, add remote server repo
git branch laptop - create a local dev branch
git remote add theserver me@server.com:/var/www/html/domain.com/.git
git remote show theserver
git push theserver laptop
On server - one time, after initial push from local, set up working branch
git checkout laptop
git branch production
Adding Source Control To Your Life
Sunday, May 19, 13
Push to remote using ssh
B) Work flow after initial setup
On local - in dev branch ‘laptop’
<edit files>
git commit -am ‘changed code’
git push theserver laptop
On server - when want changes to go live, merge the branch into working branch
git diff production laptop (show what is changing first)
git merge laptop production (do the merge)
Adding Source Control To Your Life
Sunday, May 19, 13
Push to remote using ssh
How it get’s more complicated from there ...
add other humans
add testing environments
add staging environments
add customers with issues, darn those customers!
fast iterations, push a lot, how to code review, test, etc
Adding Source Control To Your Life
Sunday, May 19, 13
Push local to github repo
github.com
Create account
Create repository
Adding Source Control To Your Life
Sunday, May 19, 13
Push local to github repo
github.com
Create account
Create repository
Adding Source Control To Your Life
Sunday, May 19, 13
Push local to github repo
Step 2
ssh-keygen -r rsa -C "email@domain.com"
Add ssh key to github ssh keys
https://help.github.com/articles/generating-ssh-keys
Step 3 - local dev
git init domain.com
cd domain.com
<add files>
git add .
git commit -a -m 'Initial commit'
Adding Source Control To Your Life
Sunday, May 19, 13
Push local to github repo
Step 4
git remote add github git@github.com:markkelnar/domain.com.git
git remote show github
git pull github master
git push github master
Adding Source Control To Your Life
Example SSH repo locator
Sunday, May 19, 13
Pull from github repo
Step 5 (on the server, one time setup)
ssh-keygen -t rsa -C "email@domain.com"
cd /var/www/html/
git init domain.com
git remote add github git@github.com:markkelnar/domain.com.git
git remote show github
Step 6
git pull github master
Adding Source Control To Your Life
Sunday, May 19, 13
Adding Source Control To Your Life
Questions so far?
Sunday, May 19, 13
*~
.svn
.cvs
.git
.listing
*.bak
*.swp
cache
.cache
temp
tmp
*.tmp
imagecache*
uploads*
*_backup
wp-config-sample.php
wp-content/w3tc*
wp-content/w3-*
wp-content/upgrade/*
wp-content/uploads
wp-content/blogs.dir/*/*
pclzip-*
log.txt
debug.log
gallery/*
wp-content/gallery/*
wp-content/album/*
wp-content/plugins/plugins
.htaccess ?
wp-config.php ?
Ignore some files
Adding Source Control To Your Life
Sunday, May 19, 13
Common Excuses (end...)
I heard it's hard.
I’m a solo developer.
I don't have money.
I don't have time.
Adding Source Control To Your Life
Sunday, May 19, 13
If time for more time ...
What about staging branches?
What about pull requests?
Adding Source Control To Your Life
feature
branches
staging
branch
production
branch
bug fixes
pull request
pull request
Sunday, May 19, 13
Resources
Adding Source Control To Your Life
http://git-scm.com/downloads
https://help.github.com/articles/set-up-git
https://help.github.com/articles/generating-ssh-keys
http://code.google.com/p/tortoisegit/
Sunday, May 19, 13
Thanks!
Adding Source Control To Your Life
Sunday, May 19, 13

Weitere ähnliche Inhalte

Was ist angesagt?

InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
InspiringCon15: Bringing TYPO3 Legacy Applications into the FlowInspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
InspiringCon15: Bringing TYPO3 Legacy Applications into the Flowmhelmich
 
Git inter-snapshot public
Git  inter-snapshot publicGit  inter-snapshot public
Git inter-snapshot publicSeongJae Park
 
Git & Github Workshop - Le Wagon Melbourne
Git & Github Workshop - Le Wagon MelbourneGit & Github Workshop - Le Wagon Melbourne
Git & Github Workshop - Le Wagon MelbournePaal Ringstad
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon MelbournePaal Ringstad
 
Submitting Your First Plugin to WordPress.org
Submitting Your First Plugin to WordPress.orgSubmitting Your First Plugin to WordPress.org
Submitting Your First Plugin to WordPress.orgLinchpin
 
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everythingZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everythingGianluca Arbezzano
 
Ankara jug mayıs 2013 sunumu
Ankara jug mayıs 2013 sunumuAnkara jug mayıs 2013 sunumu
Ankara jug mayıs 2013 sunumuAnkara JUG
 
Tracking large game assets with Git LFS
Tracking large game assets with Git LFSTracking large game assets with Git LFS
Tracking large game assets with Git LFSTim Pettersen
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use ItDaniel Kummer
 
DO YOU WANT TO USE A VCS
DO YOU WANT TO USE A VCSDO YOU WANT TO USE A VCS
DO YOU WANT TO USE A VCSSeongJae Park
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainLemi Orhan Ergin
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git TogetherRakesh Jha
 
Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016Tim Pettersen
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution beginSeongJae Park
 

Was ist angesagt? (20)

InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
InspiringCon15: Bringing TYPO3 Legacy Applications into the FlowInspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
 
Git inter-snapshot public
Git  inter-snapshot publicGit  inter-snapshot public
Git inter-snapshot public
 
Contributing to Xen with GitHub
Contributing to Xen with GitHubContributing to Xen with GitHub
Contributing to Xen with GitHub
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git & Github Workshop - Le Wagon Melbourne
Git & Github Workshop - Le Wagon MelbourneGit & Github Workshop - Le Wagon Melbourne
Git & Github Workshop - Le Wagon Melbourne
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon Melbourne
 
Submitting Your First Plugin to WordPress.org
Submitting Your First Plugin to WordPress.orgSubmitting Your First Plugin to WordPress.org
Submitting Your First Plugin to WordPress.org
 
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everythingZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
 
Vagrant - PugMI
Vagrant - PugMIVagrant - PugMI
Vagrant - PugMI
 
Ankara jug mayıs 2013 sunumu
Ankara jug mayıs 2013 sunumuAnkara jug mayıs 2013 sunumu
Ankara jug mayıs 2013 sunumu
 
Git internals
Git internalsGit internals
Git internals
 
Tracking large game assets with Git LFS
Tracking large game assets with Git LFSTracking large game assets with Git LFS
Tracking large game assets with Git LFS
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
DO YOU WANT TO USE A VCS
DO YOU WANT TO USE A VCSDO YOU WANT TO USE A VCS
DO YOU WANT TO USE A VCS
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Yes, you can git!
Yes, you can git!Yes, you can git!
Yes, you can git!
 
Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution begin
 

Ähnlich wie Adding Source Control to Your Life

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitRick Umali
 
Git workflows (Basics)
Git workflows (Basics)Git workflows (Basics)
Git workflows (Basics)Roman Kuba
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
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
 
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 for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developersmpvanwinkle
 
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...Shift Conference
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoinWilliam Chong
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github SahilSonar4
 

Ähnlich wie Adding Source Control to Your Life (20)

Git Atlrug
Git AtlrugGit Atlrug
Git Atlrug
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git workflows (Basics)
Git workflows (Basics)Git workflows (Basics)
Git workflows (Basics)
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
Git102
Git102Git102
Git102
 
GIT from n00b
GIT from n00bGIT from n00b
GIT from n00b
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git
GitGit
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
 
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 for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
Git101
Git101Git101
Git101
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
 
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
 

Kürzlich hochgeladen

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Kürzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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...
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Adding Source Control to Your Life

  • 1. Adding Source Control to your Life Mark Kelnar 2013 Sunday, May 19, 13
  • 2. Adding Source Control To Your Life Who is this guy? Mark Kelnar WP Engine - lead developer @renderandserve github.com/markkelnar Sunday, May 19, 13
  • 3. HTML JavaScript CSS PHP Java, C/C++, Python Ruby on Rails, Perl, bash etc. Adding Source Control To Your Life Do you use any of these? Sunday, May 19, 13
  • 4. Adding Source Control To Your Life Words worth remembering init clone checkout branch fetch diff commit pull push revert Sunday, May 19, 13
  • 5. Coding without source control is like ... Adding Source Control To Your Life photographer Emily West (Courtney) Sunday, May 19, 13
  • 6. Pick a version control system git, subversion (svn), cvs, mercurial, and many more Adding Source Control To Your Life Sunday, May 19, 13
  • 7. What do I do with it? Adding Source Control To Your Life domain.comlaptop / dev New header Sidebar widget Facebook feed importer Work on different project/features, switch between them seamlessly, merge them together without missing anything Sunday, May 19, 13
  • 8. Adding github.com and staging branch Adding Source Control To Your Life laptop / dev New header Sidebar widget Really cool facebook thingy laptop / dev github repo pull requests branches staging server branch testing git pull production server branch git pull pull/push pull/push pull pull Sunday, May 19, 13
  • 9. Because you want to work with other smart people who can help. Adding Source Control To Your Life Sunday, May 19, 13
  • 10. Create local repo Adding Source Control To Your Life Let’s talk about a simple example, local repo http://git-scm.com/downloads Sunday, May 19, 13
  • 11. Create local repo Adding Source Control To Your Life Sunday, May 19, 13
  • 12. Learn to branch git checkout master git checkout -b some-new-feature <edit files> git status git diff git commit -a -m ‘Edit theme for new cool feature’ <another edit> git commit -a -m ‘Forgot the blue border’ Adding Source Control To Your Life * Don’t commit it to production unless it’s ready to go live Example: Sunday, May 19, 13
  • 13. Diff then Commit Adding Source Control To Your Life Sunday, May 19, 13
  • 14. Merge branch back into main branch Adding Source Control To Your Life Sunday, May 19, 13
  • 15. Adding Source Control To Your Life Questions so far? Sunday, May 19, 13
  • 16. Push to remote using ssh Here are two ways A) push to a bare repo on server then pull to another working non-bare repo Or B) push from local branch to a branch on non-bare repo then merge that branch into checked out / production branch. B) Initial setup ssh me@server.com cd /var/www/html/ git init domain.com - at this point has no working branches, not even master. Only after initial push below On local - one time, add remote server repo git branch laptop - create a local dev branch git remote add theserver me@server.com:/var/www/html/domain.com/.git git remote show theserver git push theserver laptop On server - one time, after initial push from local, set up working branch git checkout laptop git branch production Adding Source Control To Your Life Sunday, May 19, 13
  • 17. Push to remote using ssh B) Work flow after initial setup On local - in dev branch ‘laptop’ <edit files> git commit -am ‘changed code’ git push theserver laptop On server - when want changes to go live, merge the branch into working branch git diff production laptop (show what is changing first) git merge laptop production (do the merge) Adding Source Control To Your Life Sunday, May 19, 13
  • 18. Push to remote using ssh How it get’s more complicated from there ... add other humans add testing environments add staging environments add customers with issues, darn those customers! fast iterations, push a lot, how to code review, test, etc Adding Source Control To Your Life Sunday, May 19, 13
  • 19. Push local to github repo github.com Create account Create repository Adding Source Control To Your Life Sunday, May 19, 13
  • 20. Push local to github repo github.com Create account Create repository Adding Source Control To Your Life Sunday, May 19, 13
  • 21. Push local to github repo Step 2 ssh-keygen -r rsa -C "email@domain.com" Add ssh key to github ssh keys https://help.github.com/articles/generating-ssh-keys Step 3 - local dev git init domain.com cd domain.com <add files> git add . git commit -a -m 'Initial commit' Adding Source Control To Your Life Sunday, May 19, 13
  • 22. Push local to github repo Step 4 git remote add github git@github.com:markkelnar/domain.com.git git remote show github git pull github master git push github master Adding Source Control To Your Life Example SSH repo locator Sunday, May 19, 13
  • 23. Pull from github repo Step 5 (on the server, one time setup) ssh-keygen -t rsa -C "email@domain.com" cd /var/www/html/ git init domain.com git remote add github git@github.com:markkelnar/domain.com.git git remote show github Step 6 git pull github master Adding Source Control To Your Life Sunday, May 19, 13
  • 24. Adding Source Control To Your Life Questions so far? Sunday, May 19, 13
  • 26. Common Excuses (end...) I heard it's hard. I’m a solo developer. I don't have money. I don't have time. Adding Source Control To Your Life Sunday, May 19, 13
  • 27. If time for more time ... What about staging branches? What about pull requests? Adding Source Control To Your Life feature branches staging branch production branch bug fixes pull request pull request Sunday, May 19, 13
  • 28. Resources Adding Source Control To Your Life http://git-scm.com/downloads https://help.github.com/articles/set-up-git https://help.github.com/articles/generating-ssh-keys http://code.google.com/p/tortoisegit/ Sunday, May 19, 13
  • 29. Thanks! Adding Source Control To Your Life Sunday, May 19, 13