Monday, May 30, 2022
HomeProgrammingThe best way to Flatten git Commits

The best way to Flatten git Commits


One in every of my least favourite duties as a software program engineer is resolving merge conflicts. A easy rebase is a frequent prevalence however the uncommon large battle is inevitable when many engineers work in a single codebase. One factor that helps me take care of giant rebases with many merge conflicts is flattening a department’s commits earlier than fixing merge conflicts. Let’s take a look at find out how to 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 possibly can 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!

  • 5 Ways that CSS and JavaScript Interact That You May Not Know About
  • Responsive and Infinitely Scalable JS Animations

    Again in late 2012 it was not simple to search out open supply tasks utilizing requestAnimationFrame() – that is the hook that enables Javascript code to synchronize with an internet browser’s native paint loop. Animations utilizing this technique can run at 60 fps and ship improbable…

  • Facebook-Style Modal Box Using MooTools

    In my oh-so-humble opinion, Fb’s Modal field is the perfect modal field round. It is light-weight, delicate, and really fashionable. I’ve taken Fb’s imagery and CSS and mixed it with MooTools’ superior performance to duplicate the impact. The Imagery Fb makes use of a cool sprite for his or her modal…

  • CSS Ellipsis Beginning of String

    I used to be extremely completely satisfied when CSS text-overflow: ellipsis (married with mounted width and overflow: hidden was launched to the CSS spec and browsers; the characteristic allowed us to cease attempting to marry JavaScript width calculation with string width calculation and truncation.  CSS ellipsis was additionally very pleasant to…


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments