{"thread":{"id":"45701","subject":"Git allow to unconditionaly remove files on other developer host","startedAt":"2017-04-15T11:44:12Z","lastAt":"2018-01-06T12:14:00Z","messageCount":4,"participants":["KES","Johannes Sixt","Konstantin Khomoutov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"316886","messageId":"4747541492256174@web25g.yandex.ru","threadId":"45701","inReplyTo":null,"subject":"Git allow to unconditionaly remove files on other developer host","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2017-04-15T11:36:14Z","receivedAt":"2017-04-15T11:44:12Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Hi.\n\nThat curious, but git allow to unconditionally delete files on other developer host when he do `git pull`\n\nHow to reproduce:\n\n1. File should be ignored:\necho \"somefile\" >> .gitignore\n\n2. Add this ignored file into repository\ngit add -f somefile\n\n3. Push changes to origin\ngit push\n\n4. When other developer has also 'somefile' on his host and when he does\ngit pull\n\nContent of hist local `somefile` file will be replaced by content pushed by first developer\n\nEXPECTED: git should warn about that content will be replaced and do not pull/checkout until we force pull/checkout\n"},{"id":"316890","messageId":"c09e2447-a528-9da1-9936-9b0ebfdddd78@kdbg.org","threadId":"45701","inReplyTo":"4747541492256174@web25g.yandex.ru","subject":"Re: Git allow to unconditionaly remove files on other developer host","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-04-15T12:27:00Z","receivedAt":"2017-04-15T12:27:09Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 15.04.2017 um 13:36 schrieb KES:\n> That curious, but git allow to unconditionally delete files on other developer host when he do `git pull`\n>\n> How to reproduce:\n>\n> 1. File should be ignored:\n> echo \"somefile\" >> .gitignore\n>\n> 2. Add this ignored file into repository\n> git add -f somefile\n>\n> 3. Push changes to origin\n> git push\n>\n> 4. When other developer has also 'somefile' on his host and when he does\n> git pull\n>\n> Content of hist local `somefile` file will be replaced by content pushed by first developer\n\nThis happens *only* if the other developers also have somefile mentioned \nin their .gitignore.\n\n>\n> EXPECTED: git should warn about that content will be replaced and do not pull/checkout until we force pull/checkout\n\nIf somefile is *not* mentioned in their .gitignore, the file is not \nremoved and there is a warning.\n\nKnow that Git regards everything mentioned in .gitignore as dispensible; \nIOW, by mentioning a file in .gitignore you actually give permission to \nremove the file if necessary. Git does not have a feature to say \"ignore \nthis file, but it is precious\".\n\n-- Hannes\n\n"},{"id":"316892","messageId":"20170415155324.8b011f5a0e524f8b46a235c9@domain007.com","threadId":"45701","inReplyTo":"c09e2447-a528-9da1-9936-9b0ebfdddd78@kdbg.org","subject":"Re: Git allow to unconditionaly remove files on other developer host","fromName":"Konstantin Khomoutov","fromEmail":"kostix+git@007spb.ru","sentAt":"2017-04-15T12:53:24Z","receivedAt":"2017-04-15T12:53:34Z","isPatch":false,"sender":{"key":"kostix+git@007spb.ru","avatar":null},"body":"On Sat, 15 Apr 2017 14:27:00 +0200\nJohannes Sixt <j6t@kdbg.org> wrote:\n\n> > That curious, but git allow to unconditionally delete files on\n> > other developer host when he do `git pull`\n[...]\n> Know that Git regards everything mentioned in .gitignore as\n> dispensible; IOW, by mentioning a file in .gitignore you actually\n> give permission to remove the file if necessary. Git does not have a\n> feature to say \"ignore this file, but it is precious\".\n\nKES, you might also be interested in this recent thread [1].\n\n1. http://public-inbox.org/git/CAPUVn2u0Uos2mT5+4ejj8m0okNK6XwerL6ce2miHfhtuEs-ZnQ@mail.gmail.com/\n"},{"id":"336049","messageId":"676071515240382@web58g.yandex.ru","threadId":"45701","inReplyTo":"c09e2447-a528-9da1-9936-9b0ebfdddd78@kdbg.org","subject":"Re: Git allow to unconditionaly remove files on other developer host","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2018-01-06T12:06:22Z","receivedAt":"2018-01-06T12:14:00Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"\n> This happens *only* if the other developers also have somefile mentioned\n> in their .gitignore.\n\nIt will be mentioned, because of I can add/push, wait developers pull,  add/push\n\nI can do this because I was angry or was fired. So this is my last \"surprise\" for others ))\n\n>>  EXPECTED: git should warn about that content will be replaced and do not pull/checkout until we force pull/checkout\n>\n> If somefile is *not* mentioned in their .gitignore, the file is not\n> removed and there is a warning.\n\nAs you can see the file is not just ignored in my case it is important because added to the repo\n\n\nwe can think of some sort of default configuration stored in repo. \nBut added to ignore file because developers do not want to track local changes\n(every developer has own options when configure local instance of application)\n\nit *this very important* to not lose these options while switching between branches or pull from remote.\n\nAnd I do not expect and do not want to get such \"surprises\" from anyone\n"}]}