How to show all the individual commits of a feature branch in the merge commit?

坚强是说给别人听的谎言 提交于 2021-02-08 08:03:54

问题


Right now I am using the following to merge & squash a branch:

  1. git checkout master
  2. git merge --squash feature-branch
  3. git commit
  4. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!