Do not push by force to gem repo - Ruby Developer’s Notes

iRonin IT Team - Experts in software development
best practices, developers notes, ruby

Here’s a short tip for all programmers out there: do not push by force to gem repo. Why?

If you maintain a gem (or a fork specifically for your app), do not push by force to the master branch, or actually any other branch that can be referenced in the app’s Gemfile. It may cause you some trouble.

If your Shortgem is referenced via git, you can have a problem when someone (possibly you) pushes by force. When you push by force, your Gemfile.lock needs to be updated to reflect the commit change. Otherwise you will get an error: fatal: Could not parse object 'some_commit_id'. To solve it, you need to re-generate the Gemfile.lock. The easiest way to do it:

  1. Comment the problematic gem in the Gemfile
  2. Run bundle install
  3. Uncomment the gem from the first step
  4. Run bundle install once again.

Always ensure that shared branches (such as master or develop) are merge-only and set as protected on Github or Gitlab. Do you have any questions about this issue? Or any other IT-related problems? Contact iRonin for assistance!

Today’s Developer’ Notes were shared by Łukasz, Ruby on Rails developer. Stay tuned for more tips and tricks in the near future!

Author's Bio
iRonin IT Team

Experts in software development

We are a 100% remote team of software development experts, providing web & mobile application development and DevOps services for international clients.

Similar articles

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.