• No results found

AVOIDING THE GIT OF DESPAIR

N/A
N/A
Protected

Academic year: 2021

Share "AVOIDING THE GIT OF DESPAIR"

Copied!
58
0
0

Loading.... (view fulltext now)

Full text

(1)

S I T E B U I L D I N G T R A C K 
 @ E M M A J A N E H W

http://drupal.org/user/1773

AVOIDING


THE GIT OF DESPAIR

(2)

Avoiding


The Git of Despair

@emmajanehw

http://drupal.org/user/1773 www.gitforteams.com

(3)
(4)

With Apologies


To Those Who’ve Not Seen


The Princess Bride.

(5)
(6)

Happening

• How Git works in a deployment landscape.

• How to use branches for different environments.

• Commands you need to run.

• Why it’s hard to collaborate on Features.

(7)

Not Happening

First-timer’s guide to:

• Drupal Module: Features

(8)
(9)

Drupal Module:

Features

(10)

Features

A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

Features allow us to export point-and-clicked configuration from one environment to another.

(11)
(12)

/* Sort criterion: Content: Post date */ $handler->display->display_options['sorts']
 ['created']['id'] = 'created'; $handler->display->display_options['sorts']
 ['created']['table'] = 'node'; $handler->display->display_options['sorts']
 ['created']['field'] = 'created'; $handler->display->display_options['sorts']
 ['created']['order'] = 'DESC';

(13)
(14)
(15)

Deploying Code 


with Git

(16)
(17)
(18)

(Actually)


(19)

Branches allow you to

store separate instances

of ongoing work.

(20)

Git branching strategies are

conventions we use based on

common deployment setups.

(21)
(22)
(23)

Sharing Features with Git

5,000ft View

(24)
(25)

Features

(and its related export functions)


is not always perfect but it is

always better than using nothing.

(26)

Improving Consistency

with Drush

(27)

The command line can

provide a faster route to a

more consistent experience.

(28)

Drush

• Drush is a command-line shell and scripting interface for Drupal.

• Execute cron, run update.php, work with Features, clear cache, and more.

(29)

Features focuses on code where

Drupal would have normally

focused on the database.

(30)
(31)

Features + Drush


Command Line Survival Guide

export a feature drush fu

revert a feature drush fr really revert your

features drush fra --force --yes clear all caches drush cc all

(32)

Avoiding Conflict

5,000ft View

(33)
(34)

Be Unique;


Avoid Overlap

Remember This

(35)
(36)
(37)
(38)

Getting Ready (in Git)

• Start in the right "environment"
 $ git checkout [dev]

• Create a new feature branch


(39)

Creating a Feature


(Site Builder-friendly)

• Set all Features back to their factory defaults.


$ drush fra --force --yes

• Build your new feature with the pointy-clicky.

• Export your feature’s settings with the pointy-clicky.

• Put the downloaded file into:


/sites/all/modules/features

• Unpack your new feature


(40)

Updating a Feature


(Site Builder-friendly)

• Set all Features back to their factory defaults.
 $ drush fra --force --yes

• Build your new feature with the pointy-clicky.

• Update all features to use settings from the database


$ drush features-update-all
 or


(41)
(42)

Verify Your Feature is Right

Your code is now changed to match the database.


Using Git, see what’s changed.
 $ git diff

• Checklist:

• Within an array, are the values in the same order? • Are strings (not) quoted?

• Are there extra pieces? • Are there missing pieces?

(43)
(44)

Git It Up

• Check what is currently not in your repository


$ git status

• Add the new Feature to Git


$ git add [feature_directory]

• Save the new Feature to your repository


$ git commit

• Add a really good commit message which describes

(45)
(46)

Share Your Feature

• Upload the Feature to your shared code hosting repository


(47)
(48)

Testing Someone Else’s Feature

• Update your local list of branches


$ git fetch

• Clean up your database by reverting all Features


$ drush fra --force --yes

• Switch to the branch where the new Feature is


$ git checkout --track origin/[1235-new-feature]

• Import the new Feature


(49)
(50)

Adding a Feature to a

Shared Branch

• Checkout the branch you want to add the new Feature to.


$ git checkout [dev]

• Ensure your copy of the branch is up-to-date.
 $ git pull --rebase=preserve

• Include the new Feature into the current branch
 $ git merge --no-ff [1234-new-feature]

(51)

Dealing with Conflicts

10,000ft View

(52)

Conflict is when there is

overlap at the same line.

(53)
(54)

Investigating Conflict

• Determine the point of conflict:
 $ git mergetool

• Want to undo that merge? Back the truck up.
 $ git reset --merge ORIG_HEAD

• Take another look at the differences


(55)

Choose “ours”

ours theirs

(56)

Resources

• Building a Drupal site with Git


https://www.drupal.org/node/803746

• Git for Teams


(57)

More Resources

• Features - https://drupal.org/node/580026 • Drush - http://drush.ws/

• Introduction to Drush Series


http://drupalize.me/series/introduction-drush-series

• Features & Drush Series


http://drupalize.me/series/drupal-deployment-features-drush-series

(58)

WHAT DID YOU THINK?

EVAULATE THIS SESSION - LOSANGELES2015.DRUPAL.ORG/SCHEDULE

References

Related documents

○ If BP elevated, think primary aldosteronism, Cushing’s, renal artery stenosis, ○ If BP normal, think hypomagnesemia, severe hypoK, Bartter’s, NaHCO3,

Status View your device firmware and IMEI information Management Set the Administrator password, default is ‘admin’ Restore Press to restore device to factory defaults

The objective of this study was to determine the effects of feeding zeolite A for 3 weeks prior to expected calving to multiparous Holstein cows on serum mineral status,

Overall efficiency of electricity to heat about 75% so H2 uses four times more electricity per unit of heat than HP or DH and this increases costs and means zero emission

Factory Defaults: Yes / No: Allows you to reset your Wi-Fi Camera and restart with factory default information and settings1. All stored information and settings

For this reason, your doctor will suggest that you start radiation therapy soon after your breast cancer surgery or after you complete chemotherapy.. Without radiation or other

Figure 5: IHC of Growth Factors in retina shows decrease expression in RORA knockout: VEGF and TGF-B is involved in angiogenesis and cell growth... Immunoreactivity of both VEGF

Standard CMOS Features Frequency/Voltage Control Advanced BIOS Features Load Fail-Safe Defaults Advanced Chipset Features Load Optimized Defaults Integrated Peripherals