Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8264579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:30:43+00:00 2026-06-08T04:30:43+00:00

I will be working on two projects (say project A and project B )

  • 0

I will be working on two projects (say project A and project B) that are based on the same boilerplate PHP theme. Oftentimes I’ll have to make the same change to both, even though the code will be slightly different in each project.

For example, suppose I’ve added function_1() and function_2() to A/index.php, but I want to only add function_2 to B/index.php. Or the same for removing content or making alterations.

For major changes it would be inefficient to yank-paste back and forth between files.

I’m assuming this is the sort of stuff a more advanced git tutorial might help with? — or maybe there’s a tool made especially for this purpose? — Where can I find documentation on dealing with this sort of thing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:30:46+00:00Added an answer on June 8, 2026 at 4:30 am

    What you really should do is create a “template” branch/repo which contains the common code. You then branch the customized repos from that template branch. When you make changes to the template, you can merge them into the customized repos.

    Now, since you already have the other repos present, you have to fudge the changes in. Basically create a template repo with the non-customized changes which all repos have been manually updated for. Then add the customized repos as remotes to this template repo git remote add customized1 URL and checkout the appropriate branch git checkout -t -b customized1-master customized1/master

    Then do a “fake” merge from the template’s master into each customized master:

    for f in customized1 customized2; do
      git checkout $f-master
      git merge -s ours master
      git push $f $f-master:master
    done
    

    You of course may check to see what it did before doing the push.

    At this point you have injected your template branch as a relevant ancestor to your customized repos/branches. You can then make a change to your template branch (called master in my example in this new repo) and after committing, do a real merge:

    for f in customized1 customized2; do
      git checkout $f-master
      git merge master
      git push $f $f-master:master
    done
    

    You almost certainly want to inspect what happened before you push this time. Now, changes to the template can be easily shared with all customized repos. Also if you need a new customized repo, you can branch it from the template branch.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're working in a Dynamic Data project that will handle entities coming from two
I have a small project that I will be working on shortly that collects
I have a project I am working that will search all loaded assemblies for
So, I currently am working on a project, in which two different datasources will
I am working on a function that will essentially see which of two ints
I've recently downloaded Xcode 4 and now two of my projects that were working
I have two maven projects A and B, both of which I'm actively working
My score increment is not working. Two questions. Will it automatically update? Or is
I want to start using Bing for a project which will include working out
A website I've been working on will not match data using a PHP (preg_match)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.