I've been using git-merge to merge my feature branches back into my develop
branch but when I go to view my git history, it shows as a flat line instead of the branched history I was expected with git-merge (not git-rebase).
When merging the feature branch into the develop
branch I would:
git checkout develop
git merge feature-myfeature
When viewing git history I see the following:
git log --graph --all --oneline
* be7c7de (HEAD -> develop) tiam sed tellus faucibus
* 9e365b6 (feature-add) Nulla mattis tortor, a dapibus
* 21838ed Praesent ut feugiat nunc. Ut nec varius lorem
* a1f950e (feature-fetch) Eu dapibus risus dignissim in
* 5917c65 Donec porta venenatis ex
* f67c295 Lorem ipsum dolor sit amet
* 0c7dc17 Add some sample data to work with
* 87387d7 Structure the application
* 875b0b0 (origin/main, main) First commit
I thought merging instead of rebasing would keep the branched history? Why do I only see a flat history?
I'm using git v2.29.2.
One way to have a flat/no branched look and feel is a Squashing commits - GitHub Docs which take multiple commits from the branch into one commit at the top.
Its possible that you have your setting set to default to
squash
-ing instead of merging. I prefer the squash myself in most cases.