Git: merge v.s. rebase

Michael Dubravski
1 min readSep 11, 2020

--

Photo by Yancy Min on Unsplash

Git is a widely used free and open-source distributed version control system that is used by countless developers to this day. A common conflict found when using git is the difference between the commands:

                           git merge
git rebase

Both of these commands on the surface do the same thing incorporating commits from one Git branch into another. The command git mergeallows you to concatenate the commits from one git branch into another while keeping every change that has occurred on a given feature since it was branched from master. The negative of using git merge is that it may make the logs for your master branch disorganized with commit comments making it harder to read. Thegit rebase command allows you to move commits of a branch one by one and attach them to a different commit branch. That is it basically allows you to move the base of a branch onto a different position. git rebase does not create an extra commit like git merge . Using git rebase haphazardly may result in a dangling commit (similar to a dangling pointer), where there is a commit that cannot be reached as there is no pointer to it.

--

--

Michael Dubravski
Michael Dubravski

Written by Michael Dubravski

Hello, my name is Michael Dubravski and I am a Senior at Dickinson College pursuing a major in Computer Science and a minor in Math.

No responses yet