Creating a copy of a file that will always remain similar to the original. Splitting a large file into smaller files.Regularly copying the config file would make it look like all the production-mode changes happened all at once, whereas "Git copying" the old config would - you guessed it - let other developers track the evolution of the file. But as your project gets closer to production-ready, you may realise that you want some different settings for "production" mode, and opt to have two files: and. Example, you may start out developing with one "config" file: config.js.Perhaps because they have essentially the same functionality. Other times, you might want to turn one file into multiple.This would be a prime candidate for splitting into multiple files. Example: a "page" component may start out with a few "sections", and the sections may have their own, complicated logic that's only got something to do with that section.It often happens that a small, seemingly simple component grows more and more complex, until there's too much unrelated logic in one place. For me, this is a pretty regular thing with React components.In those cases, it makes sense (and is even recommended) to split it up into smaller chunks. Sometimes, a file grows too big to be easily legible and understandable.I can think of two types of situations that I've encountered often: Not only that, but it ensures that you can also blame, or rather git blame, the right culprits for. Why would you ever want to copy a file like this? Basically, it's useful whenever you want to turn one file into multiple, but you still want to git history to stay visible, so people could track the evolution of this file. Have you ever wanted to break a long file into several smaller files, but worried about losing all the git blame history? Well, with the bash script in this post, you'll be able to split your file into as many files as you want, while still keeping the git history for every single line!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |