3 ms·
You don't even need to rewrite the source branch history. You can leave the source branch as is, and create a single commit on the main branch that is the squas
by cortesoft 4y ago
You don't even need to rewrite the source branch history. You can leave the source branch as is, and create a single commit on the main branch that is the squashed content of the source branch. It isn't considered a merge in the normal way by git, which can cause issues, but there is no lost history and GitHub and gitlab are able to keep track of the source of the squash commit.
- dahart 4y agoYeah true! It still goes to clarifying what people mean by the words “history” and “rewrite”, etc. The primary public history of a feature branch might only be preserved in the merge commit, so in some sense the preserved history is different than the branch history. It’s somewhat fair to call that rewritten. I prefer to focus on the fact the git never promised a “history” at all. Git doesn’t offer to capture what happened accurately, it only promised to keep the content of your changes and its relationship to the preceding state of the content. It only promised a sequence of dependent commits, and it allows reordering commits by design.