![]() Once you have finished resolving those conflicts, you must manually run git commit, just as you must always (for no obvious reason) do with git merge -squash and its fake merges. In the case of a conflicted (but real) merge, git merge cannot make the new commit on its own, so it stops and forces you to resolve the conflicts. This means it does not-it can not-remember which commit was merged-in. A real merge has both previous commits as its parents, but a "squash merge" has only one previous commit as its parent-the "main-line" commit. The parent linkages of the new commits differ. The second parent is the other commit, the one we just merged. The first parent is the "main-line" commit, from the branch we are on when we do the merge. This index is set up by the merge-as-a-verb process. Both new commits are made from the index (the index is Git's term for "what goes into the next commit you make"). The contents of the new commits are the same. ![]() When you do run git commit, this makes an ordinary commit, instead of a merge commit, so that the result looks like this. Instead of making a merge commit, it suppresses committing entirely-for no obvious reason-and forces you to run git commit. What git merge -squash does is to modify the last step. (The name feature continues to point to the same commit as before.) Git has added one new commit to main, and this new commit is a merge commit: it points back to both the previous tip of main, and also back (and in this case, downward as well) to the still-current tip of feature. This does a merge (verb) and makes a merge (noun), and the result looks like this. You then decide to merge the one specific feature branch back into the main branch, so you run: $ git checkout main & git merge feature Branch names are labels that point to one specific commit (the tip commit of a branch). Each round o node here represents a commit, with earlier commits towards the left. It's also worth a quick reminder, in the form of a diagram of commits, of how merges look. The difference lies in how the result is saved. ![]() ![]() Both commands perform the act of merging. The phrasing here is very important, particularly the article "a" in front of "merge": "a merge" is a noun, while "to merge" is a verb. It's worth noting here that git merge and git merge -squash are closely related, but git merge -squash does not create a merge. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |