How to use git merge --squash?

2018-12-31 09:21发布

I have a remote Git server, here is the scenario which I want to perform:

  • For each bug/feature I create a different Git branch

  • I keep on committing my code in that Git branch with un-official Git messages

  • In top repository we have to do one commit for one bug with official Git message

So how can I merge my branch to remote branch so that they get just one commit for all my check-ins (I even want to provide commit message for this)?

7条回答
一个人的天荒地老
2楼-- · 2018-12-31 09:47

If you have already git merge bugfix on main, you can squash your merge commit into one with:

git reset --soft HEAD^1
git commit
查看更多
登录 后发表回答