DEV Community

Kim Hallberg
Kim Hallberg

Posted on • Updated on

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

Discussion (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 Author

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 Author

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

Thread Thread
adriangrigore profile image
Adrian Emil Grigore • Edited on

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
puf17640 profile image
Julian Pufler

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

Collapse
thinkverse profile image
Kim Hallberg Author

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