"updating paths is incompatible with switching branches/forcing" error when using git branches with Vlad
I ended up writing this snippet after I found out that deploying a git branch with vlad wasn’t as easy as it should’ve been…
I assumed the Vlad documentation was right, so I put the branch name in the revision variable (located in config/deploy.rb):
1 set :revision, 'branch_name'
But then I got this error when executing rake vlad:deploy:
1 git checkout: updating paths is incompatible with switching branches/forcing 2 Did you intend to checkout 'branch_name' which can not be resolved as commit?
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:
1 set :revision, 'd34360870be6536992e6d45bb0aa72eca31e14443'
So after some googling I found this post at scie.nti.st, which made my day because it has the following examples of how to deploy tags and branches with git and Vlad:
1 # Deploy the latest code, this the default 2 set :revision, "HEAD" 3 4 # Deploy branch "origin/branch_name" 5 set :revision, "origin/branch_name" 6 7 # Deploy tag "1.0" 8 set :revision, "1.0"
Note that you have to push the branch to the remote server before running rake vlad:deploy:
1 git push origin branch_name