tags:

views:

92

answers:

2

I have two branches, A and B. Branch A have a directory examples with some files that are tracked by git, and these files should not appear on branch B. In my workflow, I do merge changes made in A into B often, which is a problem every time that there is some changes on examples. For the moment I am doing this manually: erasing the files after the merge or solving conflicts when there was a change to a file that I had already erased.

Is it possible to ignore these files during a merge? (Or is it possible to keep some files restricted to one branch (A) or away from one branch (B)?)


Let me try to explain why I am doing this: A is a skeleton of a blog (template, scripts, etc), B is my blog (A filled with my own posts, images, drafts, etc). A is public and I am trying to make it generic to others look and use it, but because of this I need some posts there as a showcase/tests (the examples directory). Every change in A and is later merged into B to have this changes on my blog instance -- this way all new examples appear in B and all deleted examples in B that have been changed in A since last merge results in a conflict.

+1  A: 

You might find git's rerere command useful. With that you can record resolutions for certain merge conflicts and reuse them later.

rafl
I have tried to follow this: http://progit.org/2010/03/08/rerere.htmlBut it is not working... After the conflict, `git rerere status` and `git rerere diff` doesn't show anything. I have already checked and it is in my ~/.gitconfig, I've created the directory .git/rr-cache in my repository...Anyway, I can see that this will work for the case of changing files in `examples` on `A`. Can this also work for new files?? (if a new file is created in `examples` the merge for this file will not conflict - the file will be added to `B`).
dbarbosa
+1  A: 

With your updates: Yes, submodules would be appropriate for this use if all of A fits in a subdirectory of B (or vice versa). An example of submodules using WordPress would be if you have a git repository of Wordpress; you could add a submodule for a theme which would be inside the /wp-content/themes/ directory.

The documentation for submodules might help.

If the files from the two are interleaved, it might be tougher. Most cases where submodules can be used in this way, the application in question was designed to allow for them.

pjmorse