Search code examples
gitgithubversion-control

How to manage a new feature in a separate branch? Feature itself being a size of project


I have a project with around 20 class files already. The client is asking for an experimental feature, which itself is as big as a project around 4-5 class files or even more. I don't want to connect the feature with the original project in the beginning.But later when I am sure, it works.

What is the right approach to handle such cases?

Should I create a new branch and remove all the 20 class files. And add new feature project there?

Or is there any different/better way to do this using git?

Or should I not use git for such case, and create the feature project independent of the original project?


Solution

  • For just a few additional files, a branch is a good approach, and will allow:

    • to isolate the development effort from the main development
    • to merge it back to the main branch eventually, if the experiment is deemed successful
    • to discard it if the experiment fails.

    The other approach would be to fork the repository (GitHub), or simply duplicated it (regular git clone, but pushed to a new empty repository), in order to modify it directly.

    is it conceptually right to "delete" those files, and start with a new project after deleting those files?

    The main question is the end goal:

    • contribute back to the original project: using a branch is acceptable, even if the final merge completely change the codebase.
    • having a second separate project (while maintaining/releasing the first one in parallel): having a separate repository is simpler.