{"thread":{"id":"22110","subject":"1.6.1.3: git merge --no-commit ... DID commit","startedAt":"2010-01-07T01:41:58Z","lastAt":"2010-01-07T02:13:21Z","messageCount":2,"participants":["layer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"130965","messageId":"11785.1262828518@relay.known.net","threadId":"22110","inReplyTo":null,"subject":"1.6.1.3: git merge --no-commit ... DID commit","fromName":"layer","fromEmail":"layer@known.net","sentAt":"2010-01-07T01:41:58Z","receivedAt":"2010-01-07T01:41:58Z","isPatch":false,"sender":{"key":"layer@known.net","avatar":null},"body":"quadra% git merge --no-commit duane-acl82/acl82\nUpdating 621f935..a94f7fc\nFast forward\n ChangeLog               |   23 ++++++++++++++\n src/c/fio.c             |    2 +-\n src/c/mon1.c            |    6 ++-\n src/code/debug.cl       |   10 +++++-\n src/code/lldb.cl        |   75 +++++++++++++++++++++++++++++++++++++---------\n src/code/osi-alpha.cl   |   33 ++++++++++++++++++++\n src/code/osi-alpha64.cl |   33 ++++++++++++++++++++\n src/code/x/disx86-64.cl |    4 ++\n src/rs/vrlinux.cl       |    3 +-\n src/rs/xrlinux64.cl     |   30 +++++++++++++++----\n src/rs/xrmacosx64.cl    |   44 ++++++++++++++++++++++++----\n src/rs/xrms64.cl        |   28 ++++++++++++++---\n src/rs/xrsol64.cl       |   28 ++++++++++++++---\n 13 files changed, 276 insertions(+), 43 deletions(-)\nquadra% git status\n# On branch acl82\n# Your branch is ahead of 'origin/acl82' by 2 commits.\n#\nnothing to commit (working directory clean)\nquadra% \n\n\n\nHas this been fixed in a later version?\n"},{"id":"130967","messageId":"7vwrzuhdby.fsf@alter.siamese.dyndns.org","threadId":"22110","inReplyTo":"11785.1262828518@relay.known.net","subject":"Re: 1.6.1.3: git merge --no-commit ... DID commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-07T02:13:21Z","receivedAt":"2010-01-07T02:13:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"layer <layer@known.net> writes:\n\n> quadra% git merge --no-commit duane-acl82/acl82\n> Updating 621f935..a94f7fc\n> Fast forward\n> ...\n> quadra% git status\n> # On branch acl82\n> # Your branch is ahead of 'origin/acl82' by 2 commits.\n> #\n> nothing to commit (working directory clean)\n> ...\n> Has this been fixed in a later version?\n\nIn short, there is nothing to fix.  You asked it not to create a commit,\nand the merge was a fast-forward; there was no new commit created.\n\nWhen a real merge is involved, e.g. you have this history:\n\n         x---x---x---x---B duane-acl82/acl82\n        /\n    ---O---o---o---o---A HEAD\n\ntelling \"--no-commit\" to merge creates the state to be committed in your\nwork tree and the index, notes the fact that the next \"git commit\" will\nrecord a merge between A and B, and stops.  Hence, \"git diff HEAD\" will\nshow the damange merging duane-acl82/acl82 will cause to your current\nbranch, and then you can \"git commit\" to record the merge to result in\nthis history:\n\n\n         x---x---x---x---B duane-acl82/acl82\n        /                 \\\n    ---O---o---o---o---A---* HEAD\n\nA --no-commit merge followed by committing on your own will result in a\nhistory of the same shape as \"merge\" without --no-commit will create.\n\nThink what you want to happen if you started from this history:\n\n         x---x---x---x---B duane-acl82/acl82\n        /\n    ---A HEAD\n\nIf \"merge --no-commit\" left HEAD at A but updated the index and the work\ntree to the result of the merge, which would be the same as the tree\nrecorded by commit B, and prepared to record a merge commit between A and\nB, then next \"git commit\" will not create a history of the same shape as\nyou would normally get from \"merge\" without --no-commit, which is:\n\n                           HEAD\n         x---x---x---x---B duane-acl82/acl82\n        /\n    ---A\n\nInstead, you will end up with a history of this shape, with one useless\nmerge commit:\n\n         x---x---x---x---B duane-acl82/acl82\n        /                 \\\n    ---A-------------------* HEAD\n\nThat is why \"merge --no-commit\" will fast-forward.\n\nIf you really want to do this, there is a way to create a history with\nsuch a shape (\"git merge --no-ff\") but by default it is not recommended\nand you need to explicitly ask for it (or configure).  It can also be used\ntogether with --no-commit option.\n\nOften people claim that they want to review before actually merging, but\nit is much better to get in the habit of running \"git merge topic\" first\nthen inspecting \"git diff ORIG_HEAD^ after the fact.  If the result is\nundesirable, you can always \"git reset --hard ORIG_HEAD\" it away.  The\nreason it is better is that this will work regardless of the kind of merge\nyou would end up with; you can reset away a fast-forward using ORIG_HEAD.\n\nAnother technique that may be worth learning is to do \"git diff ...topic\"\nbefore running a merge (notice three dots).\n"}]}