SlideShare una empresa de Scribd logo
1 de 52
Descargar para leer sin conexión
Intro to Git for Drupal
Or: How I Learned To Stop Worrying and Love Version Control
What’s a version control
           system?

• An application that allows you to record
  changes to your codebase in a structured
  and controlled fashion
Why do I need that?

• makes it way easier to undo errors / roll
  back to earlier versions of code
• makes it way easier to share a code base
  between developers without creating
  conflicts
• makes it waaaaay way easier to deploy
  changes from development to staging to
  production environments
Analogy:

• Using Drupal without a version control
  system is like rock climbing without any
  safety gear
• You may be able to get away with it for
  awhile, but if you slip, you’re going to die.
Some popular version control
         systems
• CVS - Concurrent Versions System
• SVN - SubVersioN
• Git
• Mercurial
• Bazaar
• LibreSource
Drupal: From CVS to Git


• drupal.org used to have all module and
  project code under CVS
• Drupal’s use of CVS system began January
  15, 2001 with check in of Drupal 3.0.0 by
  Dries Buytaert
• worked great for a few years
• over time CVS development stagnated
• other systems began to appear, newer and
  hotter
• decision to switch from CVS to Git was
  made in 2010
• Drupal officially switched from CVS to Git
  in 2011 on February 24 at 6:08 pm EST
• excellent obituary for CVS by Larry
  Garfield (Crell - http://drupal.org/user/
  26398) at http://www.garfieldtech.com/
  blog/cvs-obituary
• now entire Drupal project and all modules,
  distributions and themes use Git
So what’s Git?

• initially created in 2005 by Linus Torvalds
  for Linux kernel development
• written mostly in C
• it’s a *distributed* version control system,
  which means...
• every Git working directory contains the
  complete repository and history and full
  revision tracking capabilities
• you’re not dependent on a central server
  and you don’t have to be online
• it’s rippingly fast - much faster than SVN,
  CVS, and other systems that have a lot of
  network latency
• snapshot-based
What’s a repository?

• it’s a directory that contains all of the data
  and metadata for your Git-controlled
  project
• called .git/ and it resides in your Drupal site
  root directory
Basic Git lingo
• init
• commit   • head
• branch   • add
• merge    • status
• push     • log
• pull
Shut up already how do I start
Git thee to a command line

• there are some GUI applications for Git,
  but it’s essentially a command line tool
• it’s by far the most fun to use it on the
  command line
• in the following example we’ll be using the
  OS X terminal to connect to a local
  Ubuntu 12.04 server running in VirtualBox
• we’re going to
  a) install Git on the server
  b) set up a new Drupal site
  c) put the site into a local Git repository
     (repo)
  d) create a remote on GitHub
  e) make a commit locally and push it to the
     remote GitHub repo
Logging in to the server
To install Git on Ubuntu:

     apt-get install git-core
Set up credentials
You need to let Git know who you are so it
can label the commits you make.
So type...
git config --global user.name "Your Name"


git config --global user.email "your_email@youremail.com"
Here we have a
fresh local
Drupal
installation.

Note that every
Drupal install
includes
a .gitignore file
.gitignore files tell Git what *not* to put in the
repository, i.e.: What to ignore.

The default Drupal .gitignore file contains this:
That tells Git to ignore all
settings.php files, all files/ directories,
and all private/ directories.

You can override and add to
the .gitignore file.
Initialize!
To create your repository, navigate to your
       Drupal root folder and type:

                git init
Check status
The Git repository starts out empty.You’ll
          need to add files to it.
    But first - check the status. Type:

              git status
You’ll see a list
of “untracked”
files.

You can add
them one at a
time with “git
add
‘filename’”, or
you can add
them all at
once with...
git add .


That adds everything.
Now all of the
files except for
the ones
in .gitignore have
been staged -
they’re not in the
repo yet, but
they’re ready to
be put there.

How do you put
them there?
git commit
     Actually you’ll want to type:
git commit -m “Some text describing
           your commit”
All files have now been committed to the
repository.
If we type “git status” now, we get this:
Now what?
• Use GitHub to make your repository
  available for private or public access
Do I have to use GitHub?
• No, but it’s really cool and slightly easier
  than setting up your own Git server
• So! - create an account if you don’t have
  one (it’s free)
• login
• set up your SSH keys
SSH keys?
Entering your SSH keys establishes a trusted
connection between your GitHub account
and your development server(s), enabling
you to push and pull commits without having
to constantly enter your login information.
You can see a list of your repos on your profile. Click the
indicated button to add a new one.
Now all of the
files are
showing in the
github repo.
Dev to GitHub
• make a change on your local site and push
  the change to the GitHub repo
• in this case we’re going to install five
  modules - ctools, features, panels, token,
  and views
If you check out the sites/all/modules folder in the
GitHub repo, you’ll notice it only has a README file.
Locally, though, we’ve used Drush to download the
five modules, which are sitting in the local copy of the
sites/all/modules folder.

We want to make those modules show up on the
GitHub repo.
Running “git status” shows us that the module folders
are untracked - we need to add them.

We can get all of them at once by going to sites/all/
and typing “git add modules”.
Commit ‘em
Now we need to commit the changes. So we
type:
 git commit -a -m “Added five modules -
 views, panels, ctools, features, and token”
And then we push it:
 git push
Now if we go back to GitHub and reload the page,
the modules we pushed are all there.

Más contenido relacionado

La actualidad más candente

Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHubPuppet
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-trainingEric Guo
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostAndrew Kerr
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control SystemMohammad Imam Hossain
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 

La actualidad más candente (20)

Git real slides
Git real slidesGit real slides
Git real slides
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Learning git
Learning gitLearning git
Learning git
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHub
 
Git and Github workshop
Git and Github workshopGit and Github workshop
Git and Github workshop
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-training
 
git and github
git and githubgit and github
git and github
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git101
Git101Git101
Git101
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and Devpost
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Git 101
Git 101Git 101
Git 101
 

Similar a Intro to Git for Drupal 7

Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your ProjectManish Suwal 'Enwil'
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
August OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedAugust OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedHoward Greenberg
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Ahmed El-Arabawy
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
Git Introductive
Git IntroductiveGit Introductive
Git IntroductiveAdham Saad
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfGDSCKNUST
 
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
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 

Similar a Intro to Git for Drupal 7 (20)

Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Demo
DemoDemo
Demo
 
August OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedAugust OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub Explained
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
 
Git Training
Git TrainingGit Training
Git Training
 
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
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git Mastery
Git MasteryGit Mastery
Git Mastery
 

Último

🐬 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
 
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
 
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
 
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 Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
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
 
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
 
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.pdfsudhanshuwaghmare1
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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 Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
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
 
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
 
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
 
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?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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?
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Intro to Git for Drupal 7

  • 1. Intro to Git for Drupal Or: How I Learned To Stop Worrying and Love Version Control
  • 2. What’s a version control system? • An application that allows you to record changes to your codebase in a structured and controlled fashion
  • 3. Why do I need that? • makes it way easier to undo errors / roll back to earlier versions of code • makes it way easier to share a code base between developers without creating conflicts
  • 4. • makes it waaaaay way easier to deploy changes from development to staging to production environments
  • 5. Analogy: • Using Drupal without a version control system is like rock climbing without any safety gear
  • 6. • You may be able to get away with it for awhile, but if you slip, you’re going to die.
  • 7. Some popular version control systems • CVS - Concurrent Versions System • SVN - SubVersioN • Git • Mercurial • Bazaar • LibreSource
  • 8. Drupal: From CVS to Git • drupal.org used to have all module and project code under CVS • Drupal’s use of CVS system began January 15, 2001 with check in of Drupal 3.0.0 by Dries Buytaert
  • 9. • worked great for a few years • over time CVS development stagnated • other systems began to appear, newer and hotter • decision to switch from CVS to Git was made in 2010
  • 10. • Drupal officially switched from CVS to Git in 2011 on February 24 at 6:08 pm EST • excellent obituary for CVS by Larry Garfield (Crell - http://drupal.org/user/ 26398) at http://www.garfieldtech.com/ blog/cvs-obituary • now entire Drupal project and all modules, distributions and themes use Git
  • 11.
  • 12.
  • 13.
  • 14. So what’s Git? • initially created in 2005 by Linus Torvalds for Linux kernel development • written mostly in C • it’s a *distributed* version control system, which means...
  • 15. • every Git working directory contains the complete repository and history and full revision tracking capabilities • you’re not dependent on a central server and you don’t have to be online • it’s rippingly fast - much faster than SVN, CVS, and other systems that have a lot of network latency • snapshot-based
  • 16. What’s a repository? • it’s a directory that contains all of the data and metadata for your Git-controlled project • called .git/ and it resides in your Drupal site root directory
  • 17. Basic Git lingo • init • commit • head • branch • add • merge • status • push • log • pull
  • 18. Shut up already how do I start
  • 19. Git thee to a command line • there are some GUI applications for Git, but it’s essentially a command line tool • it’s by far the most fun to use it on the command line
  • 20. • in the following example we’ll be using the OS X terminal to connect to a local Ubuntu 12.04 server running in VirtualBox
  • 21. • we’re going to a) install Git on the server b) set up a new Drupal site c) put the site into a local Git repository (repo) d) create a remote on GitHub e) make a commit locally and push it to the remote GitHub repo
  • 22. Logging in to the server
  • 23. To install Git on Ubuntu: apt-get install git-core
  • 24. Set up credentials You need to let Git know who you are so it can label the commits you make. So type...
  • 25. git config --global user.name "Your Name" git config --global user.email "your_email@youremail.com"
  • 26. Here we have a fresh local Drupal installation. Note that every Drupal install includes a .gitignore file
  • 27. .gitignore files tell Git what *not* to put in the repository, i.e.: What to ignore. The default Drupal .gitignore file contains this:
  • 28. That tells Git to ignore all settings.php files, all files/ directories, and all private/ directories. You can override and add to the .gitignore file.
  • 29. Initialize! To create your repository, navigate to your Drupal root folder and type: git init
  • 30. Check status The Git repository starts out empty.You’ll need to add files to it. But first - check the status. Type: git status
  • 31. You’ll see a list of “untracked” files. You can add them one at a time with “git add ‘filename’”, or you can add them all at once with...
  • 32. git add . That adds everything.
  • 33. Now all of the files except for the ones in .gitignore have been staged - they’re not in the repo yet, but they’re ready to be put there. How do you put them there?
  • 34. git commit Actually you’ll want to type: git commit -m “Some text describing your commit”
  • 35.
  • 36. All files have now been committed to the repository. If we type “git status” now, we get this:
  • 37. Now what? • Use GitHub to make your repository available for private or public access
  • 38. Do I have to use GitHub? • No, but it’s really cool and slightly easier than setting up your own Git server • So! - create an account if you don’t have one (it’s free) • login • set up your SSH keys
  • 39. SSH keys? Entering your SSH keys establishes a trusted connection between your GitHub account and your development server(s), enabling you to push and pull commits without having to constantly enter your login information.
  • 40.
  • 41. You can see a list of your repos on your profile. Click the indicated button to add a new one.
  • 42.
  • 43.
  • 44.
  • 45. Now all of the files are showing in the github repo.
  • 46. Dev to GitHub • make a change on your local site and push the change to the GitHub repo • in this case we’re going to install five modules - ctools, features, panels, token, and views
  • 47. If you check out the sites/all/modules folder in the GitHub repo, you’ll notice it only has a README file.
  • 48. Locally, though, we’ve used Drush to download the five modules, which are sitting in the local copy of the sites/all/modules folder. We want to make those modules show up on the GitHub repo.
  • 49. Running “git status” shows us that the module folders are untracked - we need to add them. We can get all of them at once by going to sites/all/ and typing “git add modules”.
  • 50.
  • 51. Commit ‘em Now we need to commit the changes. So we type: git commit -a -m “Added five modules - views, panels, ctools, features, and token” And then we push it: git push
  • 52. Now if we go back to GitHub and reload the page, the modules we pushed are all there.