Urgent.News

What's breaking now, across thousands of outlets.

Tech

Lazygit's M Key Hides Four Merge Options — Here's the Git History Each One Leaves Behind

I use lazygit daily, and for a long time M was just "the merge key". Press it, pick the option, the merge happens. It took me a while to actually slow down and pay attention to the options in the menu. Each option runs the same merge, but the commit graph left behind is different, and that influences the git history. So I did what I do with any keystroke I don't fully understand: I built a…

Lazygit's "M" key provides four merge options that affect the resulting commit graph and commit history. By pressing "M" on the branch you wish to merge, a panel appears with the following choices: regular merge (fast forward), regular merge (with merge commit), squash merge and leave uncommitted, and squash merge and commit. Each option creates a distinct merge graph and alters the history left behind.

To experiment, set up a throwaway repository with three commits on a feature branch. Then, open the repo in lazygit, navigate to the branches panel, and press "M". After each experiment, run "git log --oneline --graph" to observe the resulting history graph. Finally, use "git reset --hard HEAD@{1}" to switch between options.

The regular merge (fast forward) option, triggered by "m", merges the source branch into the target branch smoothly when possible. It creates a linear history without a merge commit, but lacks a clear marker for the merge. Conversely, the regular merge (with merge commit) option, triggered by "n", always generates a merge commit, marking the point where a branch landed in the target branch.

The squash merge and leave uncommitted option, activated by "s", combines the source branch's commits into a single commit on the target branch, preserving the individual commits' messages. Meanwhile, the squash merge and commit option, activated by "S", performs the same squash operation but requires you to enter a new commit message for the resulting single commit. Each option provides distinct benefits and trade-offs when merging branches in a Git repository.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Building Pune Pulse: a real-time 3D digital twin with an IDM/MOBIL traffic engine

I wanted to see my city — Pune, India — alive in 3D. Not a game with a fictional map, and not a navigation app tracking where I am.

  • Pune Pulse is a free Android app rendering Pune's road geometry and buildings.
  • The app uses IDM and MOBIL models for traffic simulation and rerouting.
  • Offline functionality is ensured without accessing OSM or using GPS.

How to run a provably fair giveaway in 10 lines of code

Every giveaway or raffle eventually gets the same comment: "this was rigged." Usually it wasn't — but there's no way for anyone outside the organizer to check.

  • Use a public randomness beacon like QBEACON for fair selection
  • Lock entrant list before random value is determined to prevent manipulation
  • Entrant list hashed and committed, then winner selected using random value

More from Saturday 12 September →