DEV Community

Ririio
Ririio

Posted on

Git Refactoring Code

I've always had problems in terms of fixing multiple things with my code. Whenever I make multiple changes, I always thought that having my commit message explaining everything would be the best choice or I can simply commit and then push every single time.

Refactoring and rebase makes my life much easier for I can simply commit onto multiple bug fixes and addition and combining them all into a singular push.

Adding new functionalities

When writing my code, I noticed that when working with my replaceDirectory and changeLanguage function, that they have the same format with only a slight difference

Image description

With this thought, I realized that instead of simply repeating the code over and over again when working with the .env file, I can simply create a function that will do this for me thus readFileEnv was created. It takes 3 arguments and uses these values in terms of the message display, value to change, and which key to use

Finding bugs

I noticed that my output always creates a folder when the command line is used. This is a problem, because the user can simply change the output and a substantial amount of empty folder will be created. I fixed this by removing the createFolder when the command line is used, and simply overwrite the value of the .env file

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay