Dear list,

I would like to set up a repository that has multiple branches from a upstream project merged at different paths. Also, I would like to be able to access upstream history in my project (it is interpreted code, and I would like to git-blame to display a mix of local and upstream history line-by-line in the code). I have documented the steps to demonstrate my desired repository layout in the attached shell script snippet. It is self-contained and sets up two repositories upstream and main-repo in /tmp. It then reads two branches featureA and featureB from upstream into separate paths in main-repo. Then, the script modifies contents in the upstream repository. There are modifications that apply to both featureA and featureB as well as modifications to one branch only. Up to this point, things seemed to work well using either git-subtree or a combination of git-read-tree and "subtree" merge strategy. Finally, the changes to upstream are to be pulled into the corresponding paths in main-repo. Here, neither git-subtree nor git pull with subtree merge do what I want. The changes that apply to one of the features only are applied correctly. However, changes from the common history of featureA and featureB are only applied to the path that is updated first. Apparently, git records that the common change has been applied and doesn't apply it a second time (which is correct for ~99.9999999% of all use cases). In this special case however, git does not take into account that it applied the common change to a different path. I found that git pull --squash would apply the right set of updates to both featureA and featureB in main-repo (i.e. in this case, the common change would be applied on each path). However, this would leave me unlinked to upstream history.
1) Am I doing something completely wrong, am I missing some important detail?
2) Am I asking for something impossible?
3) Is it expected behaviour, that --squash adds a different set of text changes than a pull without squash?



Freiburg Brain Imaging
Tel. +761 270-54783
Fax. +761 270-54819

Description: application/shellscript

Reply via email to