DEV Community

Kim Hallberg
Kim Hallberg

Posted on β€’ Edited on

7 3

Today I learned how to merge using the CLI. πŸ§™β€β™‚οΈ

I've been a member on GitHub for 8 years now, and, as far as I can remember, have always merged branches via the web interface - believing it to be too hard and too confusing to even attempt merging via the command-line.


Me looking at the git documentation.

            Me looking at the git documentation.


So I set out to learn it, and boy where my fears overexaggerated, you just need to run git merge <branch> from the branch you want to merge into. 🀯

And if you don't want to deal with the clean-up of deleting branches on remote and local, use the github-cli and it's one command gh pr merge - it accepts more information, such as the pr number, URL or branch to merge, you can view the documentation on merge.

TL;DR

Here's the repo I used to learn how to merge using the command-line containing a detailed README of the steps I took, along with my explanation on how I perceive it to work.

GitHub logo thinkverse / merge-via-cli

Testing merging via CLI

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (8)

Collapse
 
adriangrigore profile image
Adrian Emil Grigore β€’

Haha! Have no fear of the CLI! It's very powerful!

Collapse
 
thinkverse profile image
Kim Hallberg β€’

No real fear attached, it's just that some commands are a bit confusing, and, the documentation for some isn't that user-friendly either, not talking about git specifically here, just more in general, just something I've noticed over the years. πŸ™‚

But I do agree, the command-line is darn powerful. 🀘

Collapse
 
adriangrigore profile image
Adrian Emil Grigore β€’

What operating system are you using?

Thread Thread
 
thinkverse profile image
Kim Hallberg β€’

Mac. πŸ‘¨β€πŸ’»

Thread Thread
 
adriangrigore profile image
Adrian Emil Grigore β€’ β€’ Edited

My favorites are voidlinux.org and openbsd.org.

Thread Thread
 
adriangrigore profile image
Adrian Emil Grigore β€’

As a challenge, see if you can piece together my static site generator from sources on a Mac as I don't provide binaries for it. mkws.sh/srcs.html πŸ˜›

Collapse
 
pujux profile image
Julian Pufler β€’

Might wanna fix the title, there is an , after "how to" πŸ‘

Collapse
 
thinkverse profile image
Kim Hallberg β€’

But now the title doesn't look as good. 😲

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay