Reputation: 8326
I have a file that I've been happily committing changes to. I now realize that I will need to preserve the original file, and create a new file with the work I've done. I would like the commit history to be carried to the new file.
Is this a place to use Git rebase?
Another wrinkle is that I'm working in a branch that has been pushed to a repository.
Upvotes: 0
Views: 127
Reputation: 14843
Git just doesn't track files that way.
Presuming old_file.txt and a desired new_file.txt just do
cp old_file.txt new_file.txt
git add new_file.txt
git commit -m "clone new_file.txt from old_file.txt"
To track version history of new_file.txt you would use
git log --follow new_file.txt
Upvotes: 1