<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>So Many Fish &#187; Git</title>
	<atom:link href="http://www.lisasawin.com/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lisasawin.com</link>
	<description>...which is pretty cool when you think about it...</description>
	<lastBuildDate>Fri, 26 Aug 2011 01:16:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Configuring Drupal Multisites as Git Submodules</title>
		<link>http://www.lisasawin.com/2010/03/15/configuring-drupal-multisites-as-git-submodules/</link>
		<comments>http://www.lisasawin.com/2010/03/15/configuring-drupal-multisites-as-git-submodules/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 14:01:09 +0000</pubDate>
		<dc:creator>somanyfish</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.lisasawin.com/?p=115</guid>
		<description><![CDATA[After thinking about the set up in my previous post, I decided that I wanted a good way to push changes from the dev to the production site. So, I found Simon Hamner&#8217;s post on using submodules for this and made some modifications. I also got the whole setup working with 3 sites, dev.my-project.local, my-project.local [...]]]></description>
			<content:encoded><![CDATA[<p>After thinking about the set up in <a href='http://www.lisasawin.com/2010/03/09/setting-up-drupal-multisites-under-passenger-with-git/'>my previous post</a>, I decided that I wanted a good way to push changes from the dev to the production site.  So, I found <a href='http://www.simonhanmer.com/using_git_control_drupal_multi_site_setup'>Simon Hamner&#8217;s post</a> on using submodules for this and made some modifications.  I also got the whole setup working with 3 sites, dev.my-project.local, my-project.local and www.my-project.com.<br />
<span id="more-115"></span><br />
First, I set my server with a folder called git which will hold the bare repository for my application in git/drupal and the repository for my sites called git/sites:<br />
<code>$ mkdir git<br />
$ cd git<br />
$ cd sites<br />
$ git init</code></p>
<p>I added settings.php to a .gitignore file and checked the whole thing in to master, because I don&#8217;t ever want my sites folders to track the settings for a given location. Then, I moved up the sites code I developed earlier and checked it into a dev and production branch in git/sites.  I created the bare repository for git/drupal now too.</p>
<p>Then, I went back to my local machine and removed the sites I had developed.  I added them in as submodules instead:<br />
<code>$ git submodule add ssh://&amp;lt;snip&amp;gt;/git/sites sites/dev.my-project.local<br />
$ git submodule add ssh://&amp;lt;snip&amp;gt;/git/sites sites/my-project.local<br />
$ git submodule init</code></p>
<p>I made sure that each site was tracking the right branch and then checked the changes into the application branch of my project.  Next, I added the remote repository:<br />
<code>$ git remote add origin ssh://&amp;lt;snip&amp;gt;/git/drupal<br />
$ git push origin master<br />
$ git push origin modules-and-themes<br />
$ git push origin application</code></p>
<p>Now, I&#8217;m ready to clone this onto my host machine<br />
<code>$ git clone -l git/drupal/ production<br />
$ cd production<br />
$ git fetch<br />
$ git checkout -b  modules-and-themes<br />
$ git rebase origin/modules-and-themes<br />
$ git checkout -b application<br />
$ git rebase origin/application</code></p>
<p>and check in its application<br />
<code<br />
$ git submodule add ssh://&lt;snip&gt;/git/sites sites/www.my-project.com<br />
$ git submodule init<br />
</code></p>
<p>I pushed this up and pulled it down to my local machine, so now both repositories know all about my three sites.  I will only serve the two local sites locally and the www.my-project.com from my host, but I can live with that.  I like that I can work on the two branches (dev and production) on the various sites, merge changes and commit the results as submodules into the application branch of my Drupal site.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lisasawin.com/2010/03/15/configuring-drupal-multisites-as-git-submodules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Drupal multisites under Passenger, with Git</title>
		<link>http://www.lisasawin.com/2010/03/09/setting-up-drupal-multisites-under-passenger-with-git/</link>
		<comments>http://www.lisasawin.com/2010/03/09/setting-up-drupal-multisites-under-passenger-with-git/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 18:46:10 +0000</pubDate>
		<dc:creator>somanyfish</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.lisasawin.com/?p=94</guid>
		<description><![CDATA[Here&#8217;s my steps for setting up a Drupal production and development site, with Drupal core and modules under separate Git control and running the whole thing under Passenger. I got most of this framework from Version Control Blog, but instead of using separate repositories for Drupal core and modules, I use branches. In addition, I [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my steps for setting up a Drupal production and development site, with Drupal core and modules under separate Git control and running the whole thing under Passenger.  I got most of this framework from <a href='http://www.versioncontrolblog.com/2007/08/02/upgrading-drupal-52-with-git/'>Version Control Blog</a>, but instead of using separate repositories for Drupal core and modules, I use branches.  In addition, I include the details of my Passenger setup.</p>
<p>One thing I really like about how <a href='http://www.versioncontrolblog.com'>Version Control Blog</a> illustrates this process, is setting up the project with an older version of Drupal and then upgrading at the end, to show how simple it is.  I will definitely follow that path.<br />
<span id="more-94"></span><br />
So, to begin with, create a folder with a fresh download of Drupal and commit it to Git.  At the command line:</p>
<p><code>$ drush dl drupal-6.15<br />
$ mv drupal-6.15 my-project<br />
$ cd my-project<br />
$ git init<br />
$ git add .<br />
$ git commit -m "Drupal 6.15 imported"</code></p>
<p>Now create the branch for your modules and download some modules for it:<br />
<code>$ git checkout -b "modules"<br />
$ drush dl cck<br />
$ git add .<br />
$ git commit -m "CCK 6.x-2.6 imported"<br />
$ drush dl views<br />
$ git add .<br />
$ git commit -m "Views 6.x-2.8 imported"<br />
$ git status</code></p>
<p>Now create the branch for your actual Drupal project:<br />
<code>$ git checkout -b application</code></p>
<p>Create two sites folders, one for a dev site, one for production:<br />
<code>$ mkdir sites/dev.my-projectlocal<br />
$ mkdir sites/my-project.local</code></p>
<p>Copy and rename sites/default/default.settings.php over to the two new sites folders:<br />
<code>$ cp sites/default/default.settings.php sites/dev.my-project.local/settings.php<br />
$ cp sites/default/default.settings.php sites/my-project.local/settings.php</code></p>
<p>Create the two databases in mysql:<br />
<code>mysql&gt; create database my_project;<br />
mysql&gt; create database my_project_development;</code></p>
<p>The next step is to configure Passenger to send requests for my-project.local and dev.my-project.local to our Drupal application.  For this, I need to edit my /etc/hosts file, adding these lines:<br />
<code>127.0.0.1 my-project.local<br />
127.0.0.1 dev.my-project.local</code></p>
<p>I setup Passenger via <a href='http://peepcode.com/products/phusion-passenger'>Peepcode&#8217;s Phusion Passenger screencast</a>, so my VirtualHost entry goes in a passenger_vhost.conf file and looks like this:<br />
<code>&amp;lt;VirtualHost *:80&amp;gt;<br />
    ServerName my-project.local<br />
    DocumentRoot /Library/WebServer/Documents/my-project<br />
&amp;lt;/VirtualHost *:80&amp;gt;<br />
&amp;lt;VirtualHost *:80&amp;gt;<br />
    ServerName dev. my-project.local<br />
    DocumentRoot /Library/WebServer/Documents/my-project<br />
&amp;lt;/VirtualHost *:80&amp;gt;</code></p>
<p>Don&#8217;t forget to restart your server:<br />
<code>$ sudo apachectl graceful</code></p>
<p>Now you should be able to navigate to http://my-project.local and http://dev.my-project.local and install these apps as usual.</p>
<p>When you are done, check the two sites folders into Git:<br />
<code>$ git add .<br />
$ git commit -m "Setting up development and production sites"</code></p>
<p>Don&#8217;t forget to block your webserver from exposing your Git files.  Add this line to your .htaccess file:<br />
<code>RewriteRule ^\.git - [F]</code></p>
<p>Check it into Git as well.  When I update from Drupal 6.15 to Drupal 6.16, Git nicely merges the changes to htaccess from the upgrade with my manual addition of this RewriteRule. </p>
<p>Now, here&#8217;s how to upgrade Drupal core.  I have a copy of the latest Drupal release in my Downloads directory.  I first switch back to my master branch, then copy the new Drupal files over to my project and then see what the changes are, just out of curiosity.  I add them all in to master, then checkout modules and merge master into that.  Then, I checkout application and merge modules into it.</p>
<p><code>$ git checkout master<br />
$ cp -Rf ~/Downloads/drupal-6.16/ .<br />
$ git status<br />
$  git add .<br />
$  git commit -m "Drupal 6.16 imported"<br />
$  git checkout modules<br />
$  git merge master<br />
$ git checkout application<br />
$  git merge modules</code></p>
<p>I&#8217;ll need to run the update.php script for each site, to update the databases, then I&#8217;m all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lisasawin.com/2010/03/09/setting-up-drupal-multisites-under-passenger-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yikes&#8230;.dangling commit!</title>
		<link>http://www.lisasawin.com/2008/06/10/yikesdangling-commit/</link>
		<comments>http://www.lisasawin.com/2008/06/10/yikesdangling-commit/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 19:43:39 +0000</pubDate>
		<dc:creator>somanyfish</dc:creator>
				<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.lisasawin.com/?p=5</guid>
		<description><![CDATA[   I discovered today what happens when you add and commit with git while you are not on any branch.  You get a dangling commit and it looks for all the world like there is no way to get that work back.  But all is not lost!  Between  this great post in Mathieu Martin’s blog and Eric [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p> I discovered today what happens when you add and commit with git while you are not on any branch.  You get a dangling commit and it looks for all the world like there is no way to get that work back.  But all is not lost!  Between  <a href="http://programblings.com/2008/06/07/the-illustrated-guide-to-recovering-lost-commits-with-git/"><span><strong>this great post</strong></span></a> in <a href="http://programblings.com/"><span><strong>Mathieu Martin’s blog</strong></span></a> and Eric available just when I needed him even though he’s over in France, I figured out that you can use &#8220;git fsck –lost-found&#8221; to get the sha code and then &#8220;git rebase sha&#8221; to merge that commit into your working branch.  Phew.  I had a ton of tiny, picky changes and was really not looking forward to redoing them all!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lisasawin.com/2008/06/10/yikesdangling-commit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

