<?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>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India &#187; Git</title>
	<atom:link href="http://vinsol.com/blog/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 11 Jan 2012 06:07:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Git Work Flow For Ruby on Rails Developers</title>
		<link>http://vinsol.com/blog/2009/07/24/git-work-flow-for-rails-developers/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=git-work-flow-for-rails-developers</link>
		<comments>http://vinsol.com/blog/2009/07/24/git-work-flow-for-rails-developers/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 07:32:04 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=651</guid>
		<description><![CDATA[Cross posted from darthsid
This is my very first blog post and so I though it should be about a tool that is indispensable for me &#8211; Git. I started using git about 10 months ago and looking back I can&#8217;t imagine how I managed to get work done without it. The purpose of this post [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Cross posted from <a title="Sid's Blog" href="http://darthsid.com/blog">darthsid</a></p>
<p>This is my very first blog post and so I though it should be about a tool that is indispensable for me &#8211; Git. I started using git about 10 months ago and looking back I can&#8217;t imagine how I managed to get work done without it. The purpose of this post however is not to sing git&#8217;s praises, there are lots of good articles on the web that do so much better than I ever could. Instead, I wish to share the work-flow I use on my projects. I developed this work-flow by trial and error over the months and is currently the most efficient and productive approach I can think of. If any experienced git users happen to stumble upon this post, please do provide suggestions/alternatives to help me improve my process.</p>
<p>The project I am currently working on requires me to maintain two parallel deployment branches. One is a &#8220;production branch&#8221; which is deployed on the live server and the other is a &#8220;development branch&#8221; which is deployed on a staging server. All enhancements and feature additions are done in the &#8220;development branch&#8221; and the only changes made in the &#8220;production branch&#8221; are production bug fixes that need urgent attention. Once the &#8220;development branch&#8221; is deemed stable it is merged into &#8220;production branch&#8221; and deployed.<br />
<span id="more-651"></span><br />
I&#8217;ve divided my work-flow into two parts. The first part is a generic approach which I follow in all projects, the second part is specific to the case mentioned above and discusses how I manage the two branches using git. Although I mention &#8220;Rails&#8221; in the title of this post, the work-flow I define below is not &#8220;Rails&#8221; specific and can be applied to any project where multiple deployment branches need to be maintained. I assume the reader has a basic understanding of git and is comfortable with git branches. There are lots of configuration settings in git which help you setup things like you git author name, email and colors for git commands etc. There are two I would like to mention here though:</p>
<pre class="brush: bash;">git config --global push.default &amp;quot;tracking&amp;quot;</pre>
<p>This command tells git to perform a push only to the tracked remote branch in which you are currently working.</p>
<pre class="brush: bash;">git config --global pack.threads &amp;quot;0&amp;quot;</pre>
<p>This command tells git to auto-detect the number of threads to use for packing repositories and is useful when working on a machine with more than one core.</p>
<p><big><big><strong>1. Generic Workflow</strong></big></big></p>
<p><strong>a. Start with a clean master branch.</strong></p>
<pre class="brush: bash;">
git checkout master
git pull
</pre>
<p>You now have a clean master branch. Never work directly in the master branch, instead make all changes to a local branch.</p>
<p><strong>b. Create a local branch.</strong></p>
<pre class="brush: bash;">
git branch my_local_branch
git checkout my_local_branch
</pre>
<p>or do both in one command:</p>
<pre class="brush: bash;">git checkout -b my_local_branch</pre>
<p>This creates a new local branch named &#8220;my_local_branch&#8221; and switches to it. You can now perform all changes in this branch. One good practice to follow when using git is to commit often and in small chunks. This gives you finer control on the work done and allows you to fix mistakes without losing other work. Once you are satisfied, all those smaller commits can be consolidated in a single meaningful commit.</p>
<p><strong>c. Merge with master branch.</strong></p>
<pre class="brush: bash;">
git checkout master
git pull
</pre>
<p>if new changes were pulled do the following:</p>
<pre class="brush: bash;">
git checkout my_local_branch
git rebase master
</pre>
<p>A rebase will apply the newly pulled changes in the master branch to your local branch and then apply local branch changes on top of that. This will ensure a clean merge with master. Conflicts are very common during a rebase and will need to be resolved before you can have a successful rebase. You can also pass the &#8220;-i&#8221; option to rebase to perform an interactive rebase which will alllow you to squash multiple commits into one if you so require. Once you are finished with the rebase do the following:</p>
<pre class="brush: bash;">
git checkout master
git merge my_local_branch
git push
</pre>
<p>Once you are satisfied with the push you can delete the local branch:</p>
<pre class="brush: bash;">git branch -d my_local_branch</pre>
<p><big><big><strong><br />
2. Managing Multiple Deployment Branches</strong></big></big></p>
<p>The master branch is set as the branch for production deployment and a new remote branch is created for development phase. Since I use capistrano for project deployment I set it up to have three separate tasks: &#8220;production&#8221;, &#8220;production_staging&#8221; and &#8220;development_staging&#8221;. The &#8220;production&#8221; and &#8220;production_staging&#8221; tasks use the master branch and the &#8220;development_staging&#8221; task uses the newly created remote branch. For both the remote branches you must follow the above work-flow i.e: never work directly in the branches themselves, instead create local branches to work in.</p>
<p><strong>a. Create a new remote branch.</strong></p>
<p>First create a new remote branch from our master branch:</p>
<pre class="brush: bash;">git push origin master:refs/heads/development_phase_1</pre>
<p><strong>b. Track the remote branch.</strong></p>
<p>Track the newly created remote branch:</p>
<pre class="brush: bash;">git checkout --track -b development_phase_1 origin/development_phase_1</pre>
<p>This will create a new local branch named &#8220;development_phase_1&#8243; that is tracking the remote &#8220;development_phase_1&#8243; branch. Everyone who needs to work on development branch tracks this remote &#8220;development_phase_1&#8243; branch and pushes to it. The only pushes to master branch are production fixes.</p>
<p><strong>c. Merge the development branch with the master branch.</strong></p>
<p>Once work on development branch is finished we are ready to merge the two branches:</p>
<pre class="brush: bash;">
git checkout development_phase_1
git rebase master
git checkout master
git merge development_phase_1
git push
git branch -d development_phase_1
git push origin :heads/development_phase_1
</pre>
<p>Normally a rebase is not a good idea in a remotely tracked branch but since our phase is finished and we will create a new remote branch for the next phase, I do so here. Alternatively, I could do a force push for the remote development branch and everyone working on it would need to remove and retrack it again. The second last line removes our locally tracked development branch and the last one removes it from the remote repository.</p>
<p><big><big><strong>Final Thoughts</strong></big></big></p>
<p>As I mentioned before, the above presented work-flow is not perfect by any means but it works for me. I would appreciate feedback from anyone who reads this and has some  suggestions/recommendations to help me manage my projects better.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/07/24/git-work-flow-for-rails-developers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict</title>
		<link>http://vinsol.com/blog/2008/04/23/git-error-trailing-whitespace-indent-sp-followed-by-a-tab-unresolved-merge-conflict/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=git-error-trailing-whitespace-indent-sp-followed-by-a-tab-unresolved-merge-conflict</link>
		<comments>http://vinsol.com/blog/2008/04/23/git-error-trailing-whitespace-indent-sp-followed-by-a-tab-unresolved-merge-conflict/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 18:19:34 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[VCS]]></category>
		<category><![CDATA[pre-commit]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://webonrails.com/2008/04/23/git-error-trailing-whitespace-indent-sp-followed-by-a-tab-unresolved-merge-conflict/</guid>
		<description><![CDATA[I have been using Git from last few days, and faced following errors while committing:
1) Trailing whitespace
2) Indent SP followed by a TAB
3) Unresolved merge conflict
The first error &#8220;Trailing whitespace&#8221; is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following lines(58-60) in .git/hooks/pre-commit file:

  if (/\s$/) {
    bad_line("trailing [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have been using <a href="http://git.or.cz/" target ="_blank">Git</a> from last few days, and faced following errors while committing:</p>
<p>1) Trailing whitespace<br />
2) Indent SP followed by a TAB<br />
3) Unresolved merge conflict</p>
<p>The first error <strong>&#8220;Trailing whitespace&#8221;</strong> is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following <strong>lines(58-60) in .git/hooks/pre-commit file</strong>:</p>
<textarea name="code" class="c" cols="50" rows="10">
  if (/\s$/) {
    bad_line("trailing whitespace", $_);
 }
</textarea>
<p>The second one <strong>&#8220;Indent SP followed by a TAB&#8221;</strong> is because of leading spaces/tabs. To resolve this problem comment following <strong>lines(61-63) in .git/hooks/pre-commit file</strong>:</p>
<textarea name="code" class="c" cols="50" rows="10">
  if (/^\s*   /) {
    bad_line("indent SP followed by a TAB", $_);
  }
</textarea>
<p>The third one <strong>&#8220;Unresolved merge conflict&#8221;</strong> is because of seven or more successive  occurrence of = or < or > characters. Major chances of having seven = character in README or doc files. To resolve this problem replace following <strong>line(64) in .git/hooks/pre-commit file</strong>:</p>
<textarea name="code" class="c" cols="50" rows="10">
  if (/^(?:[<>=]){7}/) {
</textarea>
<p>by </p>
<textarea name="code" class="c" cols="50" rows="10">
  if (/^(?:[<>=]){7}$/) {
</textarea>
<p>These tricks worked for me, I hope it could help you.
</p>
]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2008/04/23/git-error-trailing-whitespace-indent-sp-followed-by-a-tab-unresolved-merge-conflict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Plugin Annotate Models For Spec And Spec Fixtures</title>
		<link>http://vinsol.com/blog/2008/04/23/rails-plugin-annotate-models-for-spec-and-spec-fixtures/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rails-plugin-annotate-models-for-spec-and-spec-fixtures</link>
		<comments>http://vinsol.com/blog/2008/04/23/rails-plugin-annotate-models-for-spec-and-spec-fixtures/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 11:18:14 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[VCS]]></category>
		<category><![CDATA[annotate_models]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails plugins]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://webonrails.com/2008/04/23/rails-plugin-annotate-models-for-spec-and-spec-fixtures/</guid>
		<description><![CDATA[I have been using &#8220;Annotate Models&#8221; rails plugin written by Dave Thomas since I found it around one and half year ago. It really helps while writing fixtures. But if you use RSpec you might miss schema info at the top of your rspec fixture file as I do. So, today I modify the plugin [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have been using &#8220;Annotate Models&#8221; rails plugin written by Dave Thomas since I found it around one and half year ago. It really helps while writing fixtures. But if you use RSpec you might miss schema info at the top of your rspec fixture file as I do. So, today I modify the plugin file so that it prepends schema info to spec file and fixture file. Below are the links of patch file:</p>
<p><a href="http://webonrails.com/wp-content/plugins/wp-downloadMonitor/download.php?id=9" title="Version 0.1 downloaded 42 times" >svn patch to add schema info to spec file and spec fixture file</a><br />
<a href="http://webonrails.com/wp-content/plugins/wp-downloadMonitor/download.php?id=10" title="Version 0.1 downloaded 44 times" >git patch to add schema info to spec file and spec fixture file</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2008/04/23/rails-plugin-annotate-models-for-spec-and-spec-fixtures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git &#8211; Fast Version Control System</title>
		<link>http://vinsol.com/blog/2008/02/14/git-fast-version-control-system/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=git-fast-version-control-system</link>
		<comments>http://vinsol.com/blog/2008/02/14/git-fast-version-control-system/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 19:11:01 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[VCS]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://webonrails.com/2008/02/15/git-fast-version-control-system/</guid>
		<description><![CDATA[Git is getting popular in Rails community these days, as there were being many changes in rails to support Git.
Git is a open sourse fast version controller system. It was originally designed by Linus Torvalds to handle large projects. It was inspired by Monotone &#038; BitKeeper. It is a distributed version controlling system. It gives [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://git.or.cz/">Git</a> is getting popular in Rails community these days, as there were being many <a href="http://dev.rubyonrails.org/changeset/8772">changes</a> in rails to support Git.<br />
Git is a open sourse fast version controller system. It was originally designed by Linus Torvalds to handle large projects. It was inspired by Monotone &#038; BitKeeper. It is a distributed version controlling system. It gives you ability to commit, traverse into history while being offline. Actually every working copy of Git is a full-fledged repository. It has no central server like <a href="http://subversion.tigris.org/">SVN</a>. One can share his working-copy/repository by using various protocols like ssh, http, ftp etc. One thing I like about Git over SVN is that the size of Git&#8217;s repository, which is smaller compared to SVN.</p>
<p>I gave an introductory presentation in <a href="http://vinsol.com/">VinSol</a>. I am sharing it with you, this is not very explanatory as I focused on speech more. Please share your views.VinSol</p>
<div style="width:425px;text-align:left" id="__ss_354888"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=git1-1208284093507575-8"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=git1-1208284093507575-8" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/bansalakhil/git-fast-version-control-system-354888?src=embed" title="View 'Git- Fast version control system' on SlideShare">View</a> | <a href="http://www.slideshare.net/upload?src=embed">Upload your own</a></div></div>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2008/02/14/git-fast-version-control-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

