git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git allow to unconditionaly remove files on other developer host

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 15, 2017, 12:27 UTC
Message-ID
<c09e2447-a528-9da1-9936-9b0ebfdddd78@kdbg.org>
In-Reply-To
<4747541492256174@web25g.yandex.ru>
Am 15.04.2017 um 13:36 schrieb KES:
Show 17 quoted lines
> 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
> git push
>
> 4. When other developer has also 'somefile' on his host and when he does
> git pull
>
> 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".

-- Hannes
Previous: KESNext: Konstantin Khomoutov
Message 2 of 4 in “Git allow to unconditionaly remove files on other developer host”
  1. KESApr 15, 2017
  2. Johannes SixtApr 15, 2017
  3. Konstantin KhomoutovApr 15, 2017
  4. KESJan 6, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.