![]() Its TREE (content) differs from C2 in the same way that C5s TREE differs form C1, so it's similar to a squash. 'M' is a single commit, but unlike a C3C4C5 from the squash, M has two parents. In this case commit C3' differs form C2 exactly as C3 differs form C1, etc.īut in the case of a merge you don't get either of those. (or some variation, depending exactly what you do). This might yield C0 <- C1 <- C2 <- C3' <- C4' <- C5' master featurE_refĬ3 <- C4 <- C5 feature_ref_used_to_be_here The replay the changes from the branch, you could perform a rebasing operation. Where C3C4C5 is a single commit with one parent whose diff from C2 is equal to C5s diff from C1 (barring conflicts). Then you'd get C0 <- C1 <- C2 <- C3C4C5 master To get a squash you could use the -squash option to merge. What you get is neither a squash nor a replay of the commits. Rebasing to see how merge and rebase differ. See Git: To squash or not to squash? for more information.įinally, this "replaying" process is done by rebase, but not in the way you described. If, on the other hand, you had used git merge -squash, Git would also create a commit with the state after the merge, but the resulting commit would be like a normal commit, without two parents. Git From The Inside Out does a wonderful job at explaining this whole process. So Git would merge your files, save them, hash them and create a single hash (representing a tree object) that allows us to reconstruct that state, which is what your C6 commit will point to. ![]() They don't store differences (let's skip compression done by the gc for simplicity), they store states. Your confusion probably comes from the fact that you are not considering what commits are: they are just pointers to a state of a tree of files. Since this is a merge commit, its parent would be C5 and C2. The default strategy is the recursive, which merges by taking into account what changed between C5 and C1, and between C2 and C1. Supposing you use the command git merge without the -squash option, what happens is that Git creates a C6 commit, called a merge commit, which is a like a snapshot of your tracked files after merging their contents.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |