Git (Get) it done right! Practical Applied Version Control for Drupal site developers Peter Chen - Stanford School of Engineering Technical Webmaster.

Slides:



Advertisements
Similar presentations
Introduction To GIT Rob Di Marco Philly Linux Users Group July 14, 2008.
Advertisements

An Introduction By Sonali and Rasika.  Required for the project  Show the versions of your code in the course of development  Show versions of your.
Simple Git Steve Pieper. Topics Git considerations and Slicer Git as if it were svn Git the way it is meant to be.
Git Branching What is a branch?. Review: Distributed - Snapshots Files are stored by SHA-1 hash rather than filename Stored in git database in compressed.
Hosted Git github. From an alumni (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for the.
Patterns & practices Symposium 2013 Introducing Git version control into your team Mark
Git A distributed version control system 23-Aug-15.
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Introduction to Git and Github Joshua imtraum.com.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Distributed Version Control. Image stolen from which is really good, go read it.  Old-school version control.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Fundamentals of Git By Zachary Ling 29 th, Aug,
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Peter Ogden and Josh Levine.  Motivation  High level overview  Walk through the common operations  How not to break things (too badly)
Git – versioning and managing your software L. Grewe.
GIT An introduction to GIT Source Control. What is GIT (1 of 2) ▪ “Git is a free and open source distributed version control system designed to handle.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Warmup A programmer’s wife tells him, “Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.” The programmer.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
Version Control. How do you share code? Discussion.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
Sofia Event Center May 2014 Martin Kulov Git For TFS Developers.
Version Control System Lisa Palathingal 03/04/2015.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Version Control and SVN ECE 297. Why Do We Need Version Control?
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
CS 160 and CMPE/SE 131 Software Engineering February 16 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
Hosted Git github. From an alumnus (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
INTRODUCTION TO GIT. Install Egit for eclipse Open eclipse->Help->Install New Software Search for one of the following -
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Using Git with collaboration, code review, and code management for open source and private projects. & Using Terminal to create, and push commits to repositories.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Version Control Systems
M.Sc. Juan Carlos Olivares Rojas
Source Control Systems
CReSIS Git Tutorial.
Git Practice walkthrough.
Software Engineering for Data Scientists
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
Version Control Systems
Version Control with Git accelerated tutorial for busy academics
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
LECTURE 3: Software Configuration Management
SIG: Open Week 1: GitHub Tim Choh.
Getting Started with Git and Bitbucket
Part 1: Editing and Publishing Files
Git CS Fall 2018.
Version control with Git
Git started with git: 2018 edition
Version Control with Git and GitHub
Git GitHub.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Git (Get) it done right! Practical Applied Version Control for Drupal site developers Peter Chen - Stanford School of Engineering Technical Webmaster

What is Version Control? (why would I need it...) Your filesystem goes through frequent changes. i.e. any website. From modified files to new files coming in and old ones being deleted. If you build any kind of application (CMS) and need to keep track of “versions” of the filesystem, you need version control. If you need to share coding responsibilities or maintenance of a codebase with another person, you need version control. If you want to look like a pro at managing your code, keep a consistent history (with ease), and feel comfortable handing it off to someone else, you need version control.

Why aren't you using it today? (some convenient excuses...) I’m getting by just fine without needing to share coding responsibilities with anyone else A bad experience with Subversion crashing scared me off. I only need to make occasional upgrades to my module/theme packages, and have only one or two css files that I edit. It’s too hard (and I’m not that good at command line) to get started. branching, merging, committing, clone, init, fetch, pull, push, origin, head? Augh! I have enough trouble remembering drush commands alone and when I see those code trees, I freak out.

Types of Version Control Systems Local only - keeps a local database of changes in your local machine filesystem. Centralized - (Subversion, CVS), require a connection to a central server and “checkout” Distributed - (Git, Mercurial) allow for local systems to be “mirrors” of the central repo. You don’t need to be connected to the central server to get work or commits done.

What Git is and what it does small piece of software principally written for Linux. (mac: macports, homebrew, googlecode) (windows: googlecode) tracks all your files in it’s database. You have to add and remove files into this tracking system and commit them. a single.git directory at the top of your filesystem “watches” the changes going on and helps you deal with them at commit time. “git status” will tell you what has been added, removed, modified, etc. etc. When you make a “commit.” Git records a “snapshot” of changes to your filesystem and records an index number to it. You also write a brief message about the commit. Commit frequently!

Where it all happens global settings are in ~/.gitconfig in each local.git folder, you can have a local config file. (On windows, this is usually in the default C:\Documents and Settings\$USER directory) most activity happens locally. Frequent commits, additions, and changes. When you’re ready to share your code with others in your team, or want to get it ready for deployment to your servers, you can “push” it to your "remote" So how do I get a "remote" and how do I connect with it?

SSH, GitHub, and remotes SSH - authenticated protocol for communicating between two machines by using a private/public key pair. You put the public key on the “shared repo” machine (github, codeplane, bitbucket. etc.) so that it recognized your machine when you talk to it and can move files and info back and forth. Github has an excellent starter guide that helps you get git installed and set up ssh keys on your machine ( There are other 3rd party services like codeplane and bitbucket that you can set up a centralized repo with. But if you have a linux server or host somewhere, it can be relatively easy to set up a git remote

Git started - working with git locally invoke git init now add files now commit files add? commit? What does it mean? git status git log Congrats! We just made a git repo!

Going the other way - grabbing a repo from a remote git clone - do this just initially protocols: ssh, git:// Fine... now how do I do this with Drupal?

How a remote gets involved Going from local to remote to a deployment (or production) system o git fetch origin master o git pull origin master o git push origin master

Other important stuff to know The.gitignore file Other git commands that will become useful quite quickly checkout branch merge tag

Tools that can make Git easier For Mac: GitHub for mac ( SourceTree ( For Windows: Git for Windows ( TortoiseGit ( If you develop with an IDE, most modern IDEs such as Eclipse, Netbeans, Komodo, XCode, Aptana, Zend all have plugins for GIT and other Version Control software

Recommended practices on using this with Drupal have a.gitignore file add site/all/default (or wherever your settings.php file will reside) to it files directory should be ignored other automated files that aren’t part of your “code base” like the backup_migrate backups destination, security review report destination, etc. etc.

Some Stanford sites specific recommendations Yes, git is installed on afs. First, set up your ssh key in your afs home directory. You should probably exclude drupal core if your site is managed by sites.stanford.edu Thus git init at your sites directory have a.gitignore file at the sites directory exclude:  sites/default*  wherever your settings.php file is (if not sites/default)  wherever your files, backup_migrate destination directory are.

Some Stanford sites specific recommendations (2) Recommended workflow for a Stanford Site: 1. Set up ssh keypair in your afs home directory 2. Get your Drupal (group, dept) site in afs 3. Build your site locally, use git init to keep track of what you're doing (set.git and.gitignore up in your sites directory) 4. Set up your remote repo with a git hosting service and do your initial git push to get your code up there. 5. In afs, on your site, mv (do not delete) your original sites directory (recommend you back it to your home directory somewhere) and replace it with your git managed sites directory with git clone 6. Now restore settings.php from the original sites directory along with files and any other resources from the original sites directory that you still need.

Good resources on practicing and doing more on git Github: The ProGit book (A-press) but also online at a great tutorial that will get you far and teach some great shortcuts.

Thank You Slides will be available on or me at