2

I want to start a Git repo to be used as a basis for a new web development project with a series of pre-configured and prepared technologies (npm project, templates or views, bundlers, preprocessors, plugins, linters ...).

Also, I want to use a branch to adapt the same idea with different alternative technologies (react, vue, preact, etc...)

Having several branches with different alternative technologies, if I want to make a change that only affects that technology, I do it only in that branch, but ... If I want to make a common change in all branches (a file that affects all technologies or, for example, the update of some package to a new version)

Questions:

  • What is the best way to make a change that affects ALL branches?

  • Could someone tell me a good approach to do this in Git?

Manz
  • 948
  • 12
  • 26
  • You may find useful these answers: [How to keep a git branch in sync with master](https://stackoverflow.com/questions/16329776/how-to-keep-a-git-branch-in-sync-with-master) – Daedalus Dec 24 '18 at 15:10

2 Answers2

2

Create 3 branches:

  1. master branch - this is your first branch with all your common stuff.
  2. feature 1 branch
  3. feature 2 branch

If you want to make a change which is common to both. Then make that change/commit in master branch and then rebase your feature 1 & feature 2 branches with master branch. Run this command on both feature branches.

git branch origin/master
Jay Modi
  • 245
  • 2
  • 8
1

In addition of rebasing your branches in order to include the latest evolution of a common file, you can also create a GitHub repository based on a template.

GitHub allows to create a new repository from a template repository

And since March 2019, the new repository can include all branches of the template repository.

That means you can define your repository used as a basis for a new web development project with a series of pre-configured and prepared technologies, with its multiple branches as a GitHub template repository.
And then create new GitHub repositories for new projects, based on your original repository.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250