I've been here:
- make new git branch containing full history of only some files
- Detach (move) subdirectory into separate Git repository
- View the change history of a file using Git versioning
And also tried to make some questions in chatGPT.
Those solutions shows how to get a new branch with the history of files that are stored inside a folder. They use git filter-branch
and git subtree
commands.
But, I did not get the solution of how to create a new git branch containing full history of only one single file.
Example: Supose I have a subfolder in my project: ./src/js/mains/
containing many files, including one named test.js
.
What is the git command to get a branch containing full history of only that one single file?
Is that possible?
I'm using git for windows: git version 2.39.2.windows.1