Re: Git allow to unconditionaly remove files on other developer host
- Date: Sat, 15 Apr 2017 14:27:00 +0200
- From: Johannes Sixt <j6t@xxxxxxxx>
- Subject: Re: Git allow to unconditionaly remove files on other developer host
Am 15.04.2017 um 13:36 schrieb KES:
That curious, but git allow to unconditionally delete files on other developer host when he do `git pull`
How to reproduce:
1. File should be ignored:
echo "somefile" >> .gitignore
2. Add this ignored file into repository
git add -f somefile
3. Push changes to origin
4. When other developer has also 'somefile' on his host and when he does
Content of hist local `somefile` file will be replaced by content pushed by first developer
This happens *only* if the other developers also have somefile mentioned
in their .gitignore.
EXPECTED: git should warn about that content will be replaced and do not pull/checkout until we force pull/checkout
If somefile is *not* mentioned in their .gitignore, the file is not
removed and there is a warning.
Know that Git regards everything mentioned in .gitignore as dispensible;
IOW, by mentioning a file in .gitignore you actually give permission to
remove the file if necessary. Git does not have a feature to say "ignore
this file, but it is precious".