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

Lost file after git merge

From
LTLaďa Tesařík <lada.tesarik@olc.cz>
Date
Jul 28, 2022, 08:23 UTC
Message-ID
<HE1PR0501MB24096E2FBDB66318A2FDADAAF8969@HE1PR0501MB2409.eurprd05.prod.outlook.com>
Dear all,
recently we experienced strange behavior of git merge after deleting file in two branches and introducing it again in one of them (revision graph: https://i.stack.imgur.com/jNUZB.png):
1. I added a file called 'new_file' to a master branch.
2. Then I created branch feature/2 and deleted the file in master
3. Then I deleted the file in branch feature/2 as well.
4. I created 'new_file' on branch feature/2 again.
5. I merged feature/2 into master, merge introduced no changes, file 'new_file' is not present in master.

This could cause problems to our team in the future, fortunately we noticed it this time. Please, does anybody have any explanation for this behavior?

Or is anybody aware of any Git or Source option that changes this behaviour?
Thank you very much,
Lada Tesarik

P. S. In the picture the steps were done with git revert command, but result is the same if I delete file manually and perform git commit. Tested with git versions 2.26 and 2.37

Next: Ævar Arnfjörð Bjarmason
Message 1 of 9 in “Lost file after git merge”
  1. Laďa TesaříkJul 28, 2022
  2. Ævar Arnfjörð BjarmasonJul 28, 2022
  3. Junio C HamanoJul 28, 2022
  4. René ScharfeJul 29, 2022
  5. Junio C HamanoJul 29, 2022
  6. Elijah NewrenJul 30, 2022
  7. René ScharfeJul 30, 2022
  8. Elijah NewrenJul 31, 2022
  9. brian m. carlsonJul 28, 2022

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.