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

Losing the file during rebase

From
DODmytro Ovdiienko <dmytro.ovdiienko@iongroup.com>
Date
Jul 4, 2024, 14:28 UTC
Message-ID
<SA3PR14MB6519B74CA58C9AE49DC28513E7DE2@SA3PR14MB6519.namprd14.prod.outlook.com>
Hello,
I'd like to report an issue. I'm not sure if it is a bug. Git just behaves not in the way as I expected.

$ git --version git version 2.34.1

The problem is that Git  is losing the file when I do rebase. Following are the steps to reproduce the issue:
1. mkdir test
2. cd test
3. git init
4. touch 1.cpp
5. git add 1.cpp
6. git commit -m "Added 1.cpp"
7. touch 2.cpp
8. touch 3.cpp
9. git add 2.cpp 3.cpp
10. git commit -m "Added 2.cpp and 3.cpp"
11. git restore --source @~1 2.cpp
12. git add -u
13. git commit -m "Delete committed 2.cpp"
14. git revert @
15. git rebase -i @~3
16. Now in the opened editor
    a. move the last commit (revert commit) to the top of the commits list
    b. squash/embed  (by typing 'f') the "Delete comitted 2.cpp" commit into the commit "Added 2.cpp and 3.cpp"
17. Save and exit
18. ls
The output is : 1.cpp 3.cpp
Expected: 1.cpp 2.cpp 3.cpp
In case if at the step #16 you first do 16b, then close the editor, then start rebase again and do 16a, then all the files are on their places.

Kind regards Dmytro Ovdiienko

Please access the attached hyperlink for an important electronic communications disclaimer:https://dashfinancial.com/disclaimer<https://dashfinancial.com/disclaimer/>
Next: Elijah Newren
Message 1 of 4 in “Losing the file during rebase”
  1. Dmytro OvdiienkoJul 4, 2024
  2. Elijah NewrenJul 4, 2024
  3. Dmytro OvdiienkoJul 4, 2024
  4. brian m. carlsonJul 5, 2024

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.