Losing the file during rebase
- From
- Dmytro 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. lsThe 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/>