My buddy and I are working on a personal project, making branches as we go, and merging them back into master when the feature is done. But merging, and then deleting the branch, makes it a straight line on the log (see picture), which seems bad for keeping track of history. What should we do to work as a team and track history like it shows before a branch is deleted?
If you merge a feature branch to master and no other commits were made on master, git defaults to a fast-forward-merge. This means it will not do a real merge but simply forward master to the current commit. This results in the correct content, but causes this usually unwanted linear history.
You usually do git merge --no-ff
to avoid fast-forward merges and create an explicit merge commit.
Also have a look at What is wrong with merge commits?.