{"thread":{"id":"14734","subject":"git merge --squash isn't \"marked as a merge\"??","startedAt":"2008-07-29T07:49:29Z","lastAt":"2008-07-29T08:53:55Z","messageCount":2,"participants":["Peter Valdemar Mørch (Lists)","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85428","messageId":"488ECB89.5060801@sneakemail.com","threadId":"14734","inReplyTo":null,"subject":"git merge --squash isn't \"marked as a merge\"??","fromName":"Peter Valdemar Mørch (Lists)","fromEmail":"4ux6as402@sneakemail.com","sentAt":"2008-07-29T07:49:29Z","receivedAt":"2008-07-29T07:49:29Z","isPatch":false,"sender":{"key":"4ux6as402@sneakemail.com","avatar":null},"body":"Newbie alert:\n\nI have a feature branch where I have N tiny commits with sloppy/private\ncommit messages. Being able to have private commits was the main reason \nI'm using git (as a frontend to svn).\n\nToday the feature is in a \"good\" state, and I want to merge it into a \nmain branch, showing a single commit with a well phrased message for all \nthe world to see. So I:\n\n$ git checkout master\n$ git merge --squash feature\n$ git commit -F wellphrased.msg\n\nNow I was expecting that:\n$ git merge feature\nwould do nothing (I already did a merge!). But it pulls in all the\nsloppy commits and messages from \"feature\"!\n\nOf course now I could continue with a new branch made like this:\n$ git checkout -b feature2 master\nand continue working privately on feature2 again. Then I'll end up with\nfeature..feature47 before I'm done. Each with its own segment of my \nprivate history. A real mess.\n\nCan I continue on feature somehow so I privately can \"git log\" and\nsee all my messy commits (both before and after the \"git merge\n--squash\") and then regularly \"git merge\" and/or \"git merge --squash\"\nback and forth between \"feature\" and \"master\" as I deem appropriate?\n\nI'm guessing that if the --squash *did* put in a \"merge arrow\" (setting\na \"parent\" of the commit to the head of feature) thereby allowing merge\nto not do anything, then git log would also follow feature's sloppy\nhistory too. They go together as a pair. Is that right? Testing this:\n\ngit help merge says about --squash:\n> Produce the working tree and index state as if a real merge happened,\n> but do not actually make a commit or move the HEAD, nor record\n> $GIT_DIR/MERGE_HEAD to cause the next git commit command to create a\n> merge commit.\n\nSo I tried \"git merge --squash feature\", then set up .git/MERGE_HEAD to \nthe same contents as .git/refs/heads/feature and then \"git commit\". This \nproduced the same result as \"git merge\" without --squash including all \nthe sloppy messages.\n\nSO: It seems to me I cannot continuously merge \"feature\" to \"master\" in \nchunks with \"--squash\" as I would like. Is that right? Is my desire \nfundamentally misguided, and is there A Better Way?\n\nPeter\n-- \nPeter Valdemar Mørch\nhttp://www.morch.com\n"},{"id":"85439","messageId":"7vbq0hhxzw.fsf@gitster.siamese.dyndns.org","threadId":"14734","inReplyTo":"488ECB89.5060801@sneakemail.com","subject":"Re: git merge --squash isn't \"marked as a merge\"??","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-29T08:53:55Z","receivedAt":"2008-07-29T08:53:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Peter Valdemar Mørch (Lists)\"  <4ux6as402@sneakemail.com> writes:\n\n> Newbie alert:\n>\n> I have a feature branch where I have N tiny commits with sloppy/private\n> commit messages....\n\nProbably you would want to step back and _think_ why you want to squash in\nthe first place.  I suspect the answer would lead to a better use of the\navailable set of tools, such as \"use 'rebase -i' to clean up the original\nhistory and then 'merge' (without squash) it or 'rebase' it\".\n"}]}