Home
Introduction to Git for Drupal
Contents
1. Don t worry about Preview or Beta Select Git Bash only itk and git gui wording works great orgo in tion with regular comma Customize Git configuration on Linu Edit gitconfig user name Your Name Comes Here email you yourdomain example com difftool difftool vimdiff http www kernel org pub software scm git docs user manual html telling git your Add to bashrc alias gbv git branch v alias gbva git branch va alias gs git status Git completion stuff 2010 05 16 E source git completion sh d git completion sh can show dirty unstaged and staged GIT PS1 SHOWDIRTYSTATE true d _git_ps1 from git completior PS1 Vh myPWDS git psl appends branch name NS t x luhman org blog 2009 0 1y gi Sample first repository etc apache etc apache2 git init Initialized empty Git repository in etc apache2 git etc apache2 git add etc apache2 git commit m Initial commit master root commit da3d4d3 Initial commit of Zeuapache2 directory 119 files changed 2196 insertions 0 deletions create mode 120000 sites enabled 000 default etc apache2 ls FA1 git branches COMMIT EDITMSG config description HEAD hooks index info logs Qi ec Simple repository with multiple branc Git s killer feature Fast easy compact
2. Try to get a good set of colors for vimdiff e http luhman org blog 2009 08 25 git difftool and vimdiff sums git difftool merge tool candidates tkdiff kompare vimdiff Viewing sums php Hit return to launch tkdiff do this for each file n TkDiff 4 1 4 a File Edit View Mark Merge EE D MMMMMEMMKEMMEZZ i Bh ree S Biss 212 2 S BI v ftmp diff N tr70 R ho ENNE CO Cn 4 NO 5555 Lex ve Ve BONE BONNE on on on cO Cn NI Bisect your bugs away Find the commit which has 4 4 9 sums git bisect start sums BISECTING git bisect bad mark current commit as bad sums BISECTING git bisect good NULL mark initial tag as good Bisecting 2 revisions left to test after this roughly 1 steps fe76bdc9F4095acb0b24fc6424640439e04e2abe Append to sums php fe76bdc BISECTING grep 9 sums php didn t see 9 so good commit fe76bdc BISECTING git bisect good fe76bdc9 Bisecting 1 revisions left to test after this roughly 1 step b9661cb236c246d8ee90477857d7e468c330140c Append mistaken 4 4 b9661cb BISECTING git bisect bad b9661cb Bisecting 0 revisions left to test after this roughly 0 ste b89a9c901db024cca1979550cf8c2db23bd8629a Append more to sum b89a9c9 BISECTING grep 9 sums php b89a9c9 BISECTING git bisect good b89a9c9 b9661cb236c246d8ee904778b7d7e468c330140c is first bad commit commit b9661cb236c246d8ee90
3. gt 2010 05 23 21 58 13 Add gitignore root lt rootGu8 10s0 none gt 2010 05 23 21 58 13 Right after default installation root lt root8u8 10s0 none gt 2010 05 23 21 06 16 Patch 767690 by Crell Gfile declarations in database system do not dries lt dries gt 2010 05 23 12 14 42 Patch 553298 by yched te brian chx sunt redesign the Manage Disp dries lt dries gt 2010 05 23 12 10 22 nasan m m a SHAL ID 682a0b4d14c956d24b55cd44051232b33aboflac Rou 164 13260 Find next prev commit containing gitignore Exact All fields Search Patch w Tree Diff Old version w New version Lines of context 3 3 Comments Author root lt root u8 10s0 none gt 2010 05 23 22 14 23 ned ae acai inde eat red H Committer root lt root u8 10s0 mone gt 2010 05 23 22 14 23 EH LUE e dE ea example css Parent 623067251d621e412aa67caa2f805ac5ca422ca6 Add gitignore altid titade tasandi Child 87 748a05e0255ba37c590c53bf4f16017e3bFc5 Add views module sites al l modules examples ajax_example ajax_example info Child 6a8190b354b99d8d70af0ecd73Fd600e892e1887 Merge branch contr sites all modules examples ajax_example ajax_example js Branches contrib contribNewViews master sites all modules examples ajax example ajax example module Follows DRUPAL 7 0 ALPHAS sites all modules examples ajax example ajax example advanced Precedest inc sites all modules examples ajax example ajax example
4. intr branches repository Think how you might do similar with Drupal drupal core branch drupal contrib branch your custom code branch e master branch that merges everything together http books tag I consulting com scalability dili gel eme lg Our example Simple calculator Branch for code from addition expert branch sums Branch for code from multiplica tion expert branch prods Setup repository and create null branc mkdir gitDemo S ed _ git init Initialized empty Git repository in home me gitDemo git master touch gitignore note branch master from master git add master 4 git commit m Initial commit mpletion sh master root commit 4b14ca0 Initial commit O files changed 0 insertions 0 deletions create mode 100644 gitignore master git tag NULL create tag NULL master git branch va list all branches 1 masti M A AA master 4bl4ca0 Initial commit for empty repository master git branch m master null null git branch vz null 2514080 I kial empty Heposi Create branch sums null git checkout b sums sums cat sums php php print 1 1 2 Nn sums git status find out what needs adding committing On branch sums Untracked files use git add lt file gt to include in what will be co sums php nothing added to comm
5. prods remotes origin null cfdc52d Initial commit remotes origin prods 76fe251 Add prods php file remotes origin sums 1cf32a9 Add 545 10 master This brings up a whole discussion of handling remote branches and pushing to remote repositories http luhman org blog 2009 07 28 gitep sh how A touch of advanced topics Pre commit hooks Never commit code with syntax errors e http luuhman org blog 2010 02 12 cheap php lint checking git The best way to handle merge conflicts Avoid them Push and pull often Continuous integration with Hudson Test builds with every Git commit e http luhman org blog 2009 12 16 installin g hudson phing phpunit and git ubuntu NetBeans or other IDE integration CVS or SVN integration Migrating Drupal to Git Phase 1 Read only Git mirror of Drupal and contrib Phase 2 Drupal managed by patches with Git Limited or no branches Limited or no push pull fetch Phase 3 Fully embrace power of Git http drupal org community initiatives git http docs google com present view id dp6bhf4_6gfv8fSfq Cloning Drupal 7 git clone git github com drupal drupal git Initialized empty Git repository in root tmp gitD7 drupal git Receiving objects 100 106674 106674 21 37 MiB 155 KiB s done Resolving deltas 100 79194 79194 done cd drupal CVS git branch va CVS 386560b Patch 295990 by mr ba remotes ori
6. 4778b7d7e468c330140c Author Your name here lt you yourdomain example com gt Date Mon Jun 21 00 22 16 2010 E uw Append mistaken 4 4 9 100644 100644 28a07a97 301c44eofle M sums php b89a9c9 BISECTING git bi set done with bis Previous HEAD position was b89a9c9 ERend more to sums Switched to branch sums sums s Let s add another branch for prods sums git checkout null start from empty commit Switched to branch null null git checkout b prods create new branch named prods Switched to a new branch prods prods cat prods php php print 1 1 1 Mn print 2 2 4 Nn print 3 3 9 Nn prods git add prods php need to stage new files prods git commit m Add prods php file prods 3ef9948 Add prods php file F n 1 files changed 4 insertions 0 deletions i create mode 100644 prods php prods ls a git gitignore kprods php Prods 1 What happen Git switches file system under you when s branches Let s see both branches by merging together prods git checkout null start from empty commit Switched to branch null null git checkout b master create new branch master Switched to a new branch master master git merge sums merge in the sums branch Updating etdo52d lcf32a9 Fast forward sums php 6 1 files changed 6 insertions 0
7. Introduction to Git for Drupal David Luhman Iuhman org linkedin com in davidluhman A bit about your humble presenter Born and raised in Colorado Undergrad CU Boulder Spell Ada gt Johnson Space Center Spell FORTRAN Five years in Japan Back to CU Boulder for MBA Spell HA Silicon Valley Spell Git gt Here today From Drupal 4 6 but Drupal is not my day job 7 FA me 1 AN B A short history of version control SCCS 1972 and RCS 1982 RCS ubiguitous simple but locking amp scale issues RCS scripting CVS uo Solves locking and scale issues but adds complexity Rational ClearCase multi site 199 Distributed revision control systems d BitKeeper Used by Linus Torvalds for Linux 1999 f Git Workflow from BitKeeper Opposite of CVS 200s e Monotone Darcs Mercurial Bazaar Installing Git Make sure to install Git version 1 5 or higher Versions 1 4 x and lower have legacy commands Current version 1 7 1 from http git scm com Ubuntu apt get install git core Suggested packages git doc git cvs git svn git gui gitk Making from source is straight forward http Iuhman org blog 2009 06 1 1 building git ubuntu Mac http code google com p git osx installer Windows http code google com p msysgit Git Bash and standard Tk GUIs
8. UO diff git a sums php b sums php index 301c44e dfabbe4 100644 a sums php b sums php 8 5 0 6 print 4 4 ment 5 5 10 An gt Push Git Gui gitDemo home daddy gitDemo Repository Edit Branch Commit Merge Remote Tools Help Current Branch sums D junk txt 4 oh gt php sums php print 1 1 2 Sn print 2 2 4 n print 3 3 B Sn print 4 4 9 sn print 4 4 9 n print 5 5 10 An dl RILL 4 zm ug m k taged Changes Will Commit Yj sums php 4 Commit Message sw Cc w Amend Last Commit The following line is staged print 4 4 9 sn It has been replaced with the unstaged print 5 5 10 n Rescan Stage Changed Sign Off Commit So sums php has both staged and unstaged changes Ready Recommendations on staging Commit directly and frequently when things When adding new code When making simple bug fixes e git commit a m My commit message a means add Instead of staging just roll back to earlier commits if ne You really don t need to stage most changes When to stage changes e Single complex bug Youre feeling your way through bug resolution t Make a final all or nothing commit for the entire bug Seeing diffs visually If running X Windows use tkdiff kompare etc If terminal based try vimdiff
9. deletions create mode 100644 sums php master git merge prods merge in the prods branch F Merge made by recursive prods php 4 1 files changed 4 insertions i O deletions create mode 100644 prods php ls a Slt gartig master ow we have all files php ods ma iter Let s see our branches master git branch va verbose view of all branches master 58326e3 Merge branch prods null cfdc52d Initial commit prods 76fe251 Add prods php file PEE MS Help anne qoti2as Add 5as5eqo Merge branch prods Your name H 2010 06 22 22 54 50 Add prods php file Your name t 2010 06 22 22 52 03 A Add 5 5 10 Your name H 2010 06 22 22 50 08 master 5 gitk amp start GUI tool Append mistaken 4 4 9 Your name H 2010 06 22 22 48 53 fippend more to sums php Your name H 2010 06 22 22 45 48 master Append to sums php Your name t 2010 06 22 22 45 25 Add sums ph Your name H 2010 05 22 22 45 39 Initial commit Your name H 2010 06 22 22 43 31 SHAL ID 583266 38d5483b49F27c077469bcd7d000830d4 Ros 1 Find next prev commit containing zc All fields 4d earch I Patch Tree Diff v Old version w Neu version c Comments Author Your name here lt you yourdoma DCommitterz Your name here lt you yourd Parent 1cf32a9b2a 9deddfb26a7eeeb21 Parent 76fe251be4964ab29beddecEbaba Branch master Follows NULL Prec
10. edes Merge branch prods Fixing bugs or adding features with topic Think New bug means new temporary branc Even if fix belongs to a branch may need to work in merged master Drupal becomes inoperable if you switch to drupal contrib with no settings php master git checkout b masterAddSums create new temp branch from master Switched to a new branch masterAddSums masterAddSums echo print 6 6 12 n gt gt sums php feature masterAddSums git commit a m Add 6 6 12 on sums php masterAddSums ee3dc8f Add 6 6 12 on sums php 1 files changed 1 insertions 0 deletions masterAddSums git diff stat masterAddSums master sums php 1 1 files changed 0 insertions 1 deletions MN masterAddSums git log pretty oneline 1 find commit we added ee3dc8fba9e931a9678654602fc44617bdd6a771 Add 6 6 12 on sums php masterAddSums git checkout master Switched to branch master master git merge masterAddSums Updating 58326e3 ee3dc8f NER files changed 1 inse ster git branch d eted branch masterAd i i L d merge change into master TE temp bra a longer n Cherry pick last commit from master bac Ensure sums branch reflects all changes in master This has costs amp benefits Cost of keeping branches up to date Benefits of having a complete set of changes master git checkout sums switch to su
11. gin CVS 386560b Patch 295990 by mr bail remotes origin DRUPAL 3 0 5e5375d removed errors on empty remotes origin DRUPAL 3 00 469e0dc Renamed the SQL upgrade remotes origin DRUPAL 4 0 7244fbe Made sure session cache remotes origin DRUPAL 4 7 86c491c push version r remotes origin DRUPAL 5 bf60f36 Bump version number 11 remotes origin DRUPAL 6 69b185e Now onto Drupal 6 18 a remotes origin HEAD gt origih CVs remotes origin drop e9588cb Imported sources CVS t Pulling down fresh updates for Drupal master git remote v origin git github com drupal drupal git master git pull origin CVS From git github com drupal drupal branch CVS gt FETCH HEAD Removing modules overlay images loading gif Merge made by recursive CHANGELOG txt includes bootstrap inc includes common inc includes database mysgl schema inc includes database pgsql database inc Handling contrib modules with Git A work in progress at least for me Git submodules look promising but complex http www kernel org pub software scm git docs git submodule html gitk dzhead git mi x File Edit View Help Add views module iroot rootBu8 10s0 none 2010 05 23 22 31 36 Merge branch contrib root lt rootGu8 10s0 none gt 2010 05 23 22 14 48 ee examples project root lt root u8 10s0 none 2010 05 23 22 14 23 aitignore root lt root8u8 10s0 none
12. graceful dearadation inc sites all modules examples ajax example ajax example misc inc sites all mndules examoles hatrh examole hatrh amp xample infn Add examples project Questions and Thank you David Luhman Iuhman org linkedin com in davidluhman
13. it but untracked files present use git sums git add sums php need to add new files to track sums git commit m Add sums php note indicating staged added before commit sums 85 3934 Add sums php a 1 files changed 2 insertions 0 deletions A create mode 100644 sums php gt sums ost inprompt i othing staged after commit Append to sums php sums echo print 2 2 4 n gt gt sums php sums git status On branch sums Changed but not updated use git add lt file gt to update what will be committed use git checkout lt file gt to discard changes in c note how to rollback change checkout sum modified sums php no changes added to commit use git add and or git commit sums git add sums php stage changes by adding sums git commit m Append to sums php prompi e ASN a uoc K sums fe76bdc Append to sums php fe76bdc is SHA 1 commit hash 1 files changed 1 insertions 0 deletions i sums echo print 3 3 6 An gt gt sums php sums git commit a m Append more to sums php com sums b89a9c9 Append more to sums phy note new t files changed 1 insettio OTIS al ms Staged versus unstaged changes sums echo print 4 4 9 n gt gt sums php we ll fix error later sums cat gt junk txt We
14. ms branch Switched to branch sums sums tail 1 sums php confirm sums php lacks new li print 5 5 10 in s sums git cherry pick ee3dc8fba9e93 apply commit from master A j Finished one cherry pick i sums 74af8cd Add 6 6 12 on sums php files changed 1 insertions 0 deletions sums tail 1 sums php Mint 6 6 12 Mn confirm commit appliea master Let s move this to our prod server Problem How to move to prod server when ev server is behind a NATed firewall Solution Copy Git repository to prod and clone back to dev tar zcf gitDemo tar gz gitDemo tar up existing repo scp gitDemo tar gz me iprod com home me untar on prod com mv gitDemo gitDemoOrig don t clone over our original git clone ssh me prod com home me gitDemo Initialized empty Git repository in home me gitDemo git me prod com s password j remote Counting objects 23 done remote Compressing objects 100 20 20 done remote Total 23 delta 5 reu 3 O delta 0 Receiving objects 100 23 23 Resolving deltas 100 5 5 done one Let s see what we cloned back from p master git remote v verbose list of remote repos origin ssh me prod com home me gitDemo master git branch va verbose list of all branches master 58326e3 Merge branch prods remotes origin HEAD origin master remotes origin master 58326e3 Merge branch
15. won t stage this file just want to see unstaged in Git GUI sums git add sums php stage change to sums php sums git status On branch sums Changed but not updated use git add lt file gt to update what will be committed use git checkout lt file gt to discard changes in working directory modified sums php Untracked files A use git add lt file gt to include in what will be commit d dE dc dE dE dt junk txt changes added to comm and or git co ns t Staged versus unstaged via Git GUI sums git gui amp we ll commit change to sums php thru GUI Git Gui gitDemo home daddy gitDemo Repository Edit Branch Commit Merge Remote Tools Current Branch sums BE 1 4 1 5 BE lt php print 1 1 2 n print 2 2 4 n prn Ua Ci print 4 4 9 n P Commit Message s w Amend Last Commit Rescan Stage Changed Sign OFF Commit Y Staging can lead to some diff oddities sums git diff UO diff git a sums php b sums php index 8821e12 dfabbe4 100644 a sums php b sums php 6 6 GG print 4 4 9 Xn print 4 4 9 Xn print 5 5 10 n sums git diff staged U0 diff git a sums php b sums php index 301c44e 8821e12 100644 a sums php b sums php 5 0 6 print 4 4 9 An print 4 4 9 An sums git diff HEAD
Download Pdf Manuals
Related Search
Related Contents
Bedienungsanleitung (DE) - Han British Telecom Studio 3500 hi-Fun HI-Tube Expert Sleepers Meringue v2.0.2 User Manual Robot aspirapolvere - Migros Flashback Mini Delay Tristar KB-7351 refrigerator DSL-N17U Lire l`actualité du 5 au 7 août 2014 - AdDen avocats Montageanleitung für Gabelfedern Installation manual Copyright © All rights reserved.
Failed to retrieve file