I have a SCSS file that is ugly. I want to split it up into multiple other files to make it easier to work with.
If my file is,
file.scss
You'll need to make one commit involving both the old and new file(s) for git to associate them in the future.
Make a copy of the original but don't change the new files just yet:
cp file.scss file-sm.scss
cp file.scss file-md.scss
cp file.scss file-lg.scss
Make a minor temporary change to the original to have it committed along with the new ones:
echo "// refactoring: split the file" >> file.scss
Commit the changes:
git add .
git commit -m "Refactor: splitting up file.scss"
Now you can see the history of the old file when you use --follow and -C1 flags:
git log --follow file-lg.scss
git blame -C1 file-lg.scss
Clean up the "// refactoring .." comment and proceed with refactoring.
+1 for preserving history while refactoring - future developers will thank you.