Why did Git create a merge commit with no file changes?

You can omit creating merge commits, by using rebase instead of merge.

As @Dougal said, if you do git fetch, you can execute git rebase afterwards to change the base of your changes to the fetched HEAD.

Usually you create those unwanted merge commits, by pulling from remote repository.
In that case you can add --rebase option:

git pull --rebase

or add the proper option to Git config file (locally):

git config branch.<branch-name-here>.rebase true

or for all the new repositories and branches:

git config branch.autosetuprebase always --global

However, rebasing creates cleaner, more linear history it is good to create merge commits, where there are massive changes in both branches (use git merge to do so).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)