As Brian White said, the problem with git merge --squash is that it does not give you any visible link and therefore is not tracked back to the branch (or individual changes) that you merged into.
It can be seen (if you consider it as a git log --graph ), the important branch that was merged back is no different from the experimental branch that you encountered and happily drop it. Both just hang there, not attached to anything. I personally want to know that some branch has been merged, so I know that the work is done.
The solution that works for me is to use merging with the option without quick access.
git merge --no-ff somebranch -m "my commit message"
This forces git to create a single commit with all the branch changes enabled, you can set the commit message yourself (if you want), but most importantly, it links the new commit back to the branch it just merged into. This clearly shows that work on this branch has been completed, but also allows you to track back to view the details of individual commits from the combined branch.
Here is an example where very simple branches with one and two commits, respectively, were merged back into master. Subsequently, I removed the branch tags for the merged branches, however the branch name can still be seen in the merge commit message. The branch name should summarize the changes, and if you want to know exactly what changes are contained in it, you can track it to individual commits. This approach seems to work well for simple projects.
Note. I had to manually draw one of the connectors because it was so blue that it was barely noticeable.

samaspin Sep 02 '15 at 11:19 2015-09-02 11:19
source share