Saturday, November 16, 2024
HomeSoftware DevelopmentTips on how to Flatten git Commits

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 prevalence 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 one can flatten these commits earlier than resolving these conflicts!

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

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

To flatten commits earlier than the rebase, which might make resolving merge conflicts simpler, you possibly can barely modify the unique command:

# Whereas on the function 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!

  • Welcome to My New Office

    My first skilled net improvement was at a small print store the place I sat in a windowless cubical all day. I suffered that boxed in surroundings for nearly 5 years earlier than I used to be capable of finding a distant job the place I labored from house. The primary…

  • Animating CSS3 Transforms with MooTools Fx
  • HTML5 download Attribute

    I are likely to get caught up on the JavaScript aspect of the HTML5 revolution, and might you blame me?  HTML5 provides us superior “massive” stuff like WebSockets, Internet Staff, Historical past, Storage and little helpers just like the Aspect classList assortment.  There are, nonetheless, smaller options in…

  • Create Spinning, Fading Icons with CSS3 and MooTools

    A purpose of my newest weblog redesign was to follow what I preached a bit extra;  add a bit extra refined aptitude.  One of many methods I achieved that was by utilizing CSS3 animations to alter the show of my profile icons (RSS, GitHub, and so on.)  I…


[ad_2]
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments