Sobes.tech
Junior — Middle

Which of the two commands, git merge or git rebase, is responsible for creating a new commit in the version history?

sobes.tech AI

Answer from AI

The git merge command creates a new merge commit in the version history if the merge is not a fast-forward. This means that when branches are combined, a new commit is created to record the merge of changes.

The git rebase command does not create a merge commit; instead, it rewrites history by moving commits onto a new base, creating new commits for each changed commit, but without a merge commit as such.

Therefore, it is git merge that is responsible for creating a new commit in the version history that records the branch merge.

Which of the two commands, git merge or git rebase… - sobes.tech