Home > Mobile >  Git question regarding merge - visual display of commits from branch distinctive from master
Git question regarding merge - visual display of commits from branch distinctive from master

Time:10-27

I am new to git and my oversee something. I am not sure how to desctibe my problem, but i will try it with few words.

When i go for changes on my modules/database/etc. i usually make a new branch. In the commits i explain, what i did. (Business as usual i think). But since i develop alone, there are no changes to the master after the branching.

When i merge the branch with the master, i loose track with the branch VISUALLY since they fall together. I usually add a dummy commit to the master before branching to make both stand out.

Is there a better way (best practice) to my "problem"?Git commits shown in vs code using git graph extension

One can´t see where "branch-from-master" started and where it ended. Making it hard to understand commit comments from time to time. 2nd branch was merged AFTER i added a dummy commit to master branch which makes the commit comments stand out.

CodePudding user response:

I suppose you are issuing git merge without providing any options.

The default mode is --ff which fast-forwards (updates the branch pointer to match the merged branch) and doesn't create the merge commit when there were no changes to the "master" branch after you created "branch-from-master".

You could use git merge --no-ff to avoid fast-forward merges and create merge commits. This will make the history look the way you want it to be.

See https://blog.developer.atlassian.com/pull-request-merge-strategies-the-great-debate/

  • Related