You tried an idea on a branch and it works. Merging is the moment it becomes part of the real thing.
Remember the garden path that splits in two? Follow the side path to its end and it joins back onto the main one. From then on there’s one path again, now with everything you found along the way.
In Git, merging takes the work done on a branch and combines it into another branch, usually main. The changes you tried out on the side become part of the real version.
What actually happens
Git compares the two lines of work from the point where they split. Changes to different files, or to different parts of the same file, are combined automatically. Git then records the merge in the history, so you can always see when the branch came back in.
Usually after a check
In most teams, nobody merges straight away. First the branch is reviewed in a pull request, often with automatic tests. Once it’s approved, it’s merged.
What it isn’t
It isn’t copying files over by hand. Git combines only what changed, line by line. It also keeps the history of both sides.
It isn’t always automatic either. If two branches changed the very same lines differently, Git stops and asks a person to decide. That’s a merge conflict.
Where the comparison breaks down
Paths simply meet. Code has to fit together. Two changes can merge cleanly and still not work well side by side, which is why teams test after merging.
How the words fit together
A branch is the side path. Merging joins it back into main. A merge conflict is when two changes clash. Rebasing is another way to bring a branch up to date, by replaying it on top of the latest version.
Most merges happen automatically. Git works out how to combine the changes by itself. A person only steps in when two changes clash, which is called a merge conflict.

When you'll hear it
“It's been merged.” The change is now part of the main version.
“Can you merge my PR?” Can you join my checked changes into main?
“Squash and merge.” Combine all the branch's small commits into one tidy commit while merging.
“Once this is merged, how soon does it reach the live site?”

Try it yourselfReady to use it? The exact commands are on my other site, devcmds: Merge a branch into main ↗

