{"thread":{"id":"16522","subject":"Overwriting untracked working tree files (when identical)","startedAt":"2008-11-29T18:58:52Z","lastAt":"2008-12-01T09:28:37Z","messageCount":2,"participants":["Asheesh Laroia","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96732","messageId":"alpine.DEB.2.00.0811290018340.15382@vellum.laroia.net","threadId":"16522","inReplyTo":null,"subject":"Overwriting untracked working tree files (when identical)","fromName":"Asheesh Laroia","fromEmail":"asheesh@asheesh.org","sentAt":"2008-11-29T18:58:52Z","receivedAt":"2008-11-29T18:58:52Z","isPatch":false,"sender":{"key":"asheesh@asheesh.org","avatar":"https://avatars.githubusercontent.com/u/25457?v=4"},"body":"I was using git earlier today and got the familiar error:\n\n \t\"Untracked working tree file 'filename’ would be overwritten by merge\"\n\nAs it happens, I know that filename in my local filesystem and filename in \nthe remote git branch have the same contents.\n\nWould it make sense for git to check for this possibility, and if the \nworking tree file is the same as the file being merged in with that \nfilename, allow the overwrite?\n\n(I received the message with \"git pull,\" so I imagine it was emitted by \nthe recursive merge driver.)\n\n-- Asheesh.\n\n-- \nReply hazy, ask again later."},{"id":"96819","messageId":"4933AE45.4050400@op5.se","threadId":"16522","inReplyTo":"alpine.DEB.2.00.0811290018340.15382@vellum.laroia.net","subject":"Re: Overwriting untracked working tree files (when identical)","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-12-01T09:28:37Z","receivedAt":"2008-12-01T09:28:37Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Asheesh Laroia wrote:\n> I was using git earlier today and got the familiar error:\n> \n>     \"Untracked working tree file 'filename’ would be overwritten by merge\"\n> \n> As it happens, I know that filename in my local filesystem and filename \n> in the remote git branch have the same contents.\n> \n> Would it make sense for git to check for this possibility, and if the \n> working tree file is the same as the file being merged in with that \n> filename, allow the overwrite?\n> \n\nThat depends. git uses the work-tree to merge things. If one file is the\nsame as that about to be written, it *might* make sense to clobber it,\nbut what if it's identical to the expected merge-result? Git can't know\nthat, but it's almost certainly a much saner approach than the other\ncase, where the merge can go wahoonie-shaped at a later stage and thus\nrequire conflict resolution (which might well end up with the user\ngetting fed up and doing \"git reset --hard\" to start over). For such\ncases, the file would appear to disappear, and that's a bad thing.\n\nOverall, I think it's best if this is left as-is. The code would be too\ncomplex for the gain it provides.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}