  
<div id="snippet_224" class="snippet">
  <h2><a href="/snippets/224--updating-paths-is-incompatible-with-switching-branches-forcing-error-when-using-git-branches-with-Vlad-" title="&quot;updating paths is incompatible with switching branches/forcing&quot; error when using git branches with Vlad  - Plain Text - vlad, git, branch, deploy, revisions, tags">"updating paths is incompatible with switching branches/forcing" error when using git branches with Vlad </a></h2>
  <div class="details">
    <a style="background-color: #FFFF94;" href="http://snippets.aktagon.com/languages/103-Plain-Text">
      Plain Text</a> posted about 1 year ago by christian
          
  </div>

  <div class="body">
    <p>I ended up writing this snippet after I found out that deploying a git branch with vlad wasn&#8217;t as easy as it should&#8217;ve been&#8230;</p>


	<p>I assumed the <a href="http://hitsquad.rubyforge.org/vlad/classes/Vlad/Git.html">Vlad documentation was right</a>, so I put the branch name in the revision variable (located in config/deploy.rb): 
<pre class="active4d"><span class="line-numbers">   1 </span> set :revision,              'branch_name'
</pre></p>


	<p>But then I got this error when executing rake vlad:deploy:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> git checkout: updating paths is incompatible with switching branches/forcing
<span class="line-numbers">   2 </span> Did you intend to checkout 'branch_name' which can not be resolved as commit?
</pre></p>


	<p>I managed to solve the problem by using the  SHA1  hash of the branch instead of the branch name, but that only worked for the current revision:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> set :revision,              'd34360870be6536992e6d45bb0aa72eca31e14443'
</pre></p>


	<p>So after some googling I found <a href="http://scie.nti.st/2007/9/25/vlad-the-deployer-and-git">this post at scie.nti.st</a>, which made my day because it has the following examples of how to deploy tags and branches with git and Vlad:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> # Deploy the latest code, this the default
<span class="line-numbers">   2 </span> set :revision, &quot;HEAD&quot; 
<span class="line-numbers">   3 </span> 
<span class="line-numbers">   4 </span> # Deploy branch &quot;origin/branch_name&quot;
<span class="line-numbers">   5 </span> set :revision, &quot;origin/branch_name&quot;
<span class="line-numbers">   6 </span>  
<span class="line-numbers">   7 </span> # Deploy tag &quot;1.0&quot;
<span class="line-numbers">   8 </span> set :revision, &quot;1.0&quot;
</pre></p>


	<p>Note that you have to push the branch to the remote server before running rake vlad:deploy:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> git push origin branch_name
</pre></p>
  </div>

  <div style="font-size: 0.8em;margin:0.5em;">
    
      Tagged <a href="/tags/401-vlad">vlad</a>, <a href="/tags/385-git">git</a>, <a href="/tags/515-branch">branch</a>, <a href="/tags/403-deploy">deploy</a>, <a href="/tags/516-revisions">revisions</a>, <a href="/tags/517-tags">tags</a>
    
    
  </div>
</div>






