views:

37

answers:

1

Is there a way to copy a file (or subdirectory) within a git repo and have git merge upstream changes to both copies?

Randal Schwartz mentions that git can do this (27 minutes into this Google Tech talk: http://www.youtube.com/watch?v=8dhZ9BXQgc4 )

Background: I'm using git to track and update CMS software---i.e., I have the CMS in a git repo on my server and I pull and merge updates from the public release branch into this. The problem is that I have made a custom theme, which is a copy of the default theme directory with minor modifications (i.e. I have both the default and custom themes in my repo, and want to keep both). When I update, git merges the changes into the default theme files, but not into my custom theme, so every time there is an update to the default theme files, I have to manually make those changes in my copy. I want it to merge those changes automatically with both copies.

A: 

I have trouble fully understanding your question. Whatever you need to do in the production server can of course go inside the repository. From what I understand, you have the core CMS files with the stock theme files, which you modify (you don't modify a copy of the stock theme) and have trouble redoing these changes when there's a newer version of the CMS, right? Isn't there a way to copy the stock theme and work on the copy instead of modifying the core theme? This way you can put everything inside the repository.

Vasileios Lourdas
No, I am modifying a copy of the stock theme files. I.e. I have two directories in my repo, the stock theme directory 'default' and another 'mytheme', which I edit. The question is how to have the files in 'default' and 'mytheme' both track the changes to 'default' in the remote repo (which is not under my control). Editing 'default' as though it was my theme would side-step the issue, but doesn't solve the problem if I want to have more than one theme, or if I want to keep default as a fallback.
Mark Dayel