What strategies do people have for resolving Gemfile.lock conflicts while rebasing in Git?
I am having to do this a lot in a recent project, and not only is it tedious, it's not always clear how to do the merge.
What strategies do people have for resolving Gemfile.lock conflicts while rebasing in Git?
I am having to do this a lot in a recent project, and not only is it tedious, it's not always clear how to do the merge.
 
    
    you could relock it on every merge, through a merge driver (that I usually use to always keep the local version of a file during a merge).
See "Auto Merge Gemfile.lock" from Will Leinweber:
All you have to do is run
(obsolete in Rail3)bundle lockbundle installto getbundlerto relock then add that and continue your rebase.First is your
~/.gitconfigfile.
Here we're going to give it a new merge strategy, one that will just relock the gemfile.
Add this to the end:
[merge "gemfilelock"]
  name = relocks the gemfile.lock
  driver = bundle install
Next up, we have to tell git to use our new strategy for
Gemfile.lock, and we do that withgitattributes.
You can either put this inproject/.git/info/attributesorproject/.gitattributes.
Gemfile.lock merge=gemfilelock
Use git log Gemfile.lock to find the hash of a previous commit. Then run git checkout abcde Gemfile.lock to revert back. Your bundle install command should work after that.
 
    
    You can use this script to automatically set up a git repository to use the mentioned merge resolution strategy: https://gist.github.com/itspriddle/5548930
Alternatively, you can use tpope's hookup to do this (and run database migrations) automatically after git pulls: https://github.com/tpope/hookup
