When merging code, do you use merge
or rebase
? After asking around, I found that some people haven’t just never used rebase
, but haven’t even heard of it. Don’t worry, though — rebase
is not essential for development, merging, or releasing!
Merge
and rebase
only come into play when dealing with branch merging. If there’s no need to merge, it doesn’t matter how you do it. For example, in my small projects, I only use the main branch, I’m the sole developer, and there’s no concept of conflicts. Sometimes I go several days without even pushing my changes.
Branch merging is mostly used in team projects with multiple collaborators. Typically, there’s a main branch and development branches, and sometimes temporary feature branches as well.
Merging Branches with Merge
Even on the same branch, you might encounter merge situations. For example, I have an old project that typically no one else touches. When I’m modifying this project, I often forget to pull the latest changes first. This is, of course, a very bad habit. So, sometimes when I push my code, I discover that someone else has submitted new code. In such cases, an automatic merge happens.