Urgent.News

What's breaking now, across thousands of outlets.

Tech

10 Git Commands You’ll Wish You Knew Earlier

Do you know Git? Of course you do! Today, I’ve got a few of my favorite Git commands for you. When I was a junior developer, my tech lead taught me most of them (hi Wojtek, if you’re reading this 👋) and later, I started teaching the same commands to my own junior and mid-level developers. I’ve actually been meaning to write this article for months. But you know how it is. It’s evergreen content,…

Do you know Git? Of course you do! Today, I've compiled a list of my favorite intermediate-level Git commands that I wish I'd discovered sooner in my career. These tips come from a tech lead who taught me most of them and later shared them with junior and mid-level developers. I've been meaning to write this article for months, but finally got motivated after seeing a similar post by @francistrdev.

If you're new to Git, check out Francis's Git Gud! article first. However, if you're already comfortable with basic commands like add, commit, pull, and push, this article is for you. Let's dive into the commands!

1. git merge vs git rebase

These two commands are often confused with each other, but they have distinct purposes and outcomes. Both are used to integrate histories from one branch into another, typically updating a feature branch with changes from a main or develop branch.

Merge: When you run git merge main while on the feature branch, Git combines both histories, creating a merge commit (M) that preserves the original history. While this approach maintains the real history, it can result in a tangled, "spaghetti-like" history if merged frequently.

Rebase: Instead, running git rebase main moves your commits (D and E) onto the latest main branch and reapplies them on top, resulting in a cleaner, linear history. However, this creates new commits with different hashes, effectively rewriting history. This should be done with caution, as rebasing shared history can confuse other developers working on the same branch.

Conflicts can arise during both merge and rebase processes, but rebase can be more annoying since Git reapplies commits one by one, potentially causing multiple conflicts. If things go wrong, you can abort the operation using git merge --abort or git rebase --abort.

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

What Saltware SCR Reveals: Cutting Cloud Security Assessment from a Month to 30 Minutes

The time required for an initial cloud security assessment is being compressed from a month to minutes. Saltware, a South Korean AI and cloud specialist, said on August 26 that it had deployed its…

  • Saltware's AI-powered SCR service reduces cloud security assessment time from a month to 30 minutes.
  • SCR analyzes AWS Config data against 103 ISMS-P controls, generating visual HTML reports.
  • Backpackr adopted SCR to manage AWS infrastructure and meet ISMS-P compliance.

More from Wednesday 26 August →