squash

In git, what is the difference between merge --squash and rebase?

牧云@^-^@ 提交于 2019-11-25 23:29:01
问题 I\'m new to git and I\'m trying to understand the difference between a squash and a rebase. As I understand it you perform a squash when doing a rebase. 回答1: Both git merge --squash and git rebase --interactive can produce a "squashed" commit. But they serve different purposes. git merge --squash abranch will produce a squashed commit on the destination branch, without marking any merge relationship. (Note: it does not produce a commit right away: you need an additional git commit -m "squash

Squash my last X commits together using Git

只愿长相守 提交于 2019-11-25 22:16:23
问题 How can I squash my last X commits together into one commit using Git? 回答1: Use git rebase -i <after-this-commit> and replace "pick" on the second and subsequent commits with "squash" or "fixup", as described in the manual. In this example, <after-this-commit> is either the SHA1 hash or the relative location from the HEAD of the current branch from which commits are analyzed for the rebase command. For example, if the user wishes to view 5 commits from the current HEAD in the past the command