I have three files Shell-ijk-ArrayList.java, Shell-ijk-Vektor.java and Shell-ikj-ArrayList.java in this git-repository. I have “merged” them manually to MatrixMultiplication.java. Now I would like to get rid of the other three, but I want to keep the history of them. What is the best way to do this?
I have found git merge-file, but when I try
git merge-file MatrixMultiplication.java Shell-ijk-ArrayList.java Shell-ijk-Vektor.java
I get
error: Could not stat MatrixMultiplication.java
I could simply remove the old files with git rm, but then I’ll lose the history, won’t I?
I could also move it with git mv, but what would be a good folder for outdated files?
It looks to me like you are merging different files with separate logic into one file? That is not what git merge-file is for.
From git help merge-file:
Example (also from the help page):
To combine logic from completely separate files into one, you are right in combining them manually.
Deleting a file does not remove its history, you can see the log of a deleted file with:
See related Q/A:
Git: How to search for a deleted file in the project commit history?
Find and restore a deleted file in a Git repository