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
I want to finish with something like,
file.scss
file-sm.scss
file-md.scss
file-lg.scss
sm
, md
, and lg
will all have significant portions of the original files.scss
so I want to preserve/copy history on them to make it easier on future development and future developers.
How can I refactor a file into multiple new files and preserve, or copy over, history to the new files?
Git has built-in rename / copy detection based on file similarity. To ensure it kicks in, first do a plain copy of file.scss
to all of file-{sm,md,lg}.scss
and commit these files. Then delete the unwanted portions from these files, remove file.scss
, and commit again. Now e.g. a git log --follow --find-copies file-sm.scss
should show file-sm.scss
's history including the one of file.scss
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With