Reputation: 1635
I'm still somewhat new to Git and Gemfiles.
I want to upgrade my gems but not all are backward compatible. As such, I want to create a separate branch while I fix my code to be compatible with new gem versions.
If i use git checkout -b mynewbranch and then change Gemfile and start running bundle update, will that confine my gem changes to just that branch?
What's the best approach here?
Upvotes: 2
Views: 634
Reputation: 15788
The versions of gems installed using the bundle install
command and the gem versions that will be used is determined by the files Gemfile and Gemfile.lock.
Moving to another branch and updating using bundle update
does not interfere with those old files in the old branch. It will update those files on the new branch and install new gems versions to your machine. You can update as much as you want, go back to the old branch and all former versions of gems will be used as expected.
Note that you might need to run commands using bundle exec
in case you have multiple versions of same gem on the machine.
Upvotes: 2