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

  • Home
  • SEARCH
  • 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 4240610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:11:17+00:00 2026-05-21T03:11:17+00:00

I have some template/starting point code that I reuse across projects. While working on

  • 0

I have some template/starting point code that I reuse across projects. While working on the new project, I always want to add and change things in the template.
Develop the template alongside the project, I guess.

Some of my additions are project-specific and should no be committed to the template. Others should.

I bet I could use git for this, but I’m not sure how. I have a git repository for the template and one for each project. I would like some, but not all, commits I make to be pushed back to the template. Can I make a subset of files that don’t get committed back? Should I work on project-specific things in one branch and the template in the master?

I really appreciate any insights. My google-fu yields little.

  • 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-05-21T03:11:18+00:00Added an answer on May 21, 2026 at 3:11 am

    I would recommend creating a branch specifically for any template changes you want to make. But make sure you start it from one of the earlier commits, so you don’t get project-specific changes to your template. Something like git checkout -b template_changes EARLY_COMMIT_SHA.
    Then any template changes you have already made, you can cherry-pick in: git cherry-pick TEMPLATE_CHANGE_SHA.

    Any future changes to the template you would like to make could be done on the template branch and merged into other branches of the project; but if you are far along enough, you may want to switch to the template project.

    To push your template changes from the project into the template git repository, you could do git format-patch SHA_FROM_WHERE_TEMPLATE_BEGAN. This will create a bunch of patch files that you’ll have to copy to the template repo and run git apply 0001-... 0002-... to apply the patches, but that’s not very fun.

    A more git-fu thing to do would be to add the template repo in the project repo git remote add template /path/to/template/repo. You may have to play with the -t or -m options or the command git remote set-head template template_branch:master (or something) if the template branch exists. Then you should be able to push your changes to the template repo with git push template template_branch. If the template_branch’s head isn’t set property, you may have to git push template template_branch:master.

    Hope this works out for you. And have fun!

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

Sidebar

Related Questions

I have some template code that I would prefer to have stored in a
I have some code that looks like: template<unsigned int A, unsigned int B> int
I have some template code that looks like: <input type='submit' value='{{ need.satisfied|yesno:Resend this document
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
I have some 'spaghetti'-style code that is generously saused with Custom tags and Stored
I have some original code that manages exception safety like this: void foo() {
I have some flatpages with empty content field and their content inside the template
I have a template in word (.docx) format and want to replace some placeholders
I have some C++ source code with templates maybe like this - doxygen runs
I have some UI in VB 2005 that looks great in XP Style, but

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.