Git merge commits
I'm new to git (and enjoying it a lot!). While developing in a new branch, I kept committing the various development 'states' of my application. Now I have to check it in for review but didn't want everything to go in different commits (different comments and ids).
How can I do a push of all changes as if it was the first time?
git rebase -i HEAD~5
allows you to interactively select which of the 5 last commits to join into one; off the top of my head it opens the editor with something like this
pick xxxx commit1
pick xxxx commit2
pick xxxx commit3
pick xxxx commit4
pick xxxx commit5
you change this into
pick xxxx commit1
squash xxxx commit2
squash xxxx commit3
squash xxxx commit4
pick xxxx commit5
which results in two commits being left: first one that has combined commits 1 - 4, and commit 5 (the newest one) which is left alone
I think it's a good idea to keep your "micro commits". You can do a diff from the last commit before your feature to the current HEAD to see the entire diff which you can send for review.
链接地址: http://www.djcxy.com/p/23452.html下一篇: Git合并提交