Tips on how to Flatten git Commits

[ad_1]

Certainly one of my least favourite duties as a software program engineer is resolving merge conflicts. A easy rebase is a frequent incidence however the uncommon huge battle is inevitable when many engineers work in a single codebase. One factor that helps me cope with giant rebases with many merge conflicts is flattening a department’s commits earlier than fixing merge conflicts. Let’s take a look at how you can flatten these commits earlier than resolving these conflicts!

My typical command for rebasing off of the principle department is:

# Whereas on the characteristic department...
git rebase -i grasp

To flatten commits earlier than the rebase, which might make resolving merge conflicts simpler, you’ll be able to barely modify the unique command:

# Whereas on the characteristic department...
# git rebase -i HEAD~[NUMBER_OF_COMMITS]
git rebase -i HEAD~10

The instance above would flatten the final 10 commits on the department. With only one single commit, you keep away from the stop-start nature of fixing merge conflicts with a number of commits!

  • Responsive Images: The Ultimate Guide

    Chances are high that any Internet designers utilizing our Ghostlab browser testing app, which permits seamless testing throughout all units concurrently, could have labored with responsive design in some form or kind. And as at the moment’s web sites and units turn out to be ever extra various, a plethora of responsive photos…

  • 5 More HTML5 APIs You Didn’t Know Existed

    The HTML5 revolution has offered us some superior JavaScript and HTML APIs.  Some are APIs we knew we have wanted for years, others are leading edge cell and desktop helpers.  No matter API energy or function, something to assist us higher do our job is a…

  • jQuery Link Nudge Plugin
  • spellcheck Attribute

    Many helpful attributes have been offered to internet builders lately:  obtain, placeholder, autofocus, and extra.  One useful older attribute is the spellcheck attribute which permits builders to  management an parts potential to be spell checked or topic to grammar checks.  Easy sufficient, proper?


[ad_2]

Leave a Reply