问题
Right now I am using the following to merge & squash a branch:
- git checkout master
- git merge --squash feature-branch
- git commit
- git push
This merges the feature branch into master in one single commit, which is almost what I want.
I can achieve this using a pull request.
So the merge commit includes a link to the PR, which has a nice list of all the commits I made in that feature branch. https://i.stack.imgur.com/y2FZu.png
I would like to include a history like a GitHub pull request does. https://i.stack.imgur.com/6f10X.png
My question is, is there a way to achieve this without using a PR? I would like to show a similar layout to the PR's list of commits, but inside the actual merge commit itself.
回答1:
After a git merge --squash, try as illustrated here, a git commit --no-edit
All the commit messages inside .git/SQUASH_MSG should then be part of your commit message, which should allow you to keep track of the individual commits that were done before the squash.
回答2:
Try using the command git commit --no-edit in your terminal. It should include all of your commit messages in your one, squashed final commit message.
来源:https://stackoverflow.com/questions/53492868/how-to-show-all-the-individual-commits-of-a-feature-branch-in-the-merge-commit