![]() ![]() Since there's no divergence between the two histories, Git can just move the master branch up to where topic sits without doing anything interesting. If you had this tree, were on the master branch, and ran git merge, Git would perform what's called a "fast-forward" merge. To understand, it's best to look at an example: A -> B -> C -> D -> E Refuse to merge and exit with a non-zero status unless the current HEAD is already up-to-date or the merge can be resolved as a For reference, here's what the manual has to say about -no-ff and it's opposite -ff-only:Ĭreate a merge commit even when the merge resolves as a fast-forward. It forces Git into creating a merge commit even if it's not really necessary. no-ff is a slightly different operation. It prevents Git from creating a merge commit, but still pulls in the changes C and D made, so your tree looks like this: A -> B -> F'į' contains changes C and D made, but there's no sign of the fact you merged two trees in the repository. Git merge -squash would do something a little different. It forces Git to create a merge commit to bring two histories together. See how A, B, C, and D are regular commits, but F is a merge commit, since it has multiple parents ( B and D)? This is what git merge -no-ff would produce. A regular commit has one parent, and is simply a changeset to apply to the commit before it: A -> B -> CĪ merge commit has multiple parents, and it a place in the tree where you've brought two or more lineages together: A -> B -> F To start, we need to understand the difference between a regular commit and a merge commit. That's a bit confusing, and requires some knowledge about the internals of git. With -no-squash perform the merge and commit the result. Whose effect is the same as merging another branch (or more in case of ThisĪllows you to create a single commit on top of the current branch Make a commit or move the HEAD, nor record $GIT_DIR/MERGE_HEAD toĬause the next git commit command to create a merge commit. Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually The help page for merge says the following about -squash: no-ff and -squash are not opposites, rather they are subtly different operations. I think your question indicates a bit of a misunderstanding. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |