The problem: I'm getting a merge conflict every time I try to pull into my subtree even when I have no changes.
What I'm doing:
In subtree-repo
# Make some changes
$ git commit -am 'Changes made'
$ git push origin master
In main-repo
$ git subtree add --prefix public/common {{subtree-repo}} master --squash
# Make some changes
$ git commit -am 'Changes made'
$ git subtree push --prefix public/common {{subtree-repo}} master
In subtree-repo
$ git pull origin master
# Make some changes
$ git commit -am 'Changes made'
$ git push origin master
In main-repo
$ git subtree pull --prefix public/common {{subtree-repo}} master --squash
And this is where things blow up. The pull gives me:
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From {{subtree-repo}}
* branch master -> FETCH_HEAD
a53e6fc..c078461 master -> {{subtree-repo}}/master
Auto-merging public/common/README.md
CONFLICT (content): Merge conflict in public/common/README.md
Automatic merge failed; fix conflicts and then commit the result.
So why am I getting a merge conflict when I haven't made any changes?
What I'm trying to accomplish: I have a web project and a mobile project I'm building on Cordova. Because they're both using JavaScript I have several components and models I want to share between the two. I'd like to put these common things in a shared folder between the two of them so I don't have to copy paste. I looked into the pros/cons of submodules and subtrees and decided on subtrees. This is a one-man project right now, but I would like to do things the right way so it can scale.
Note: If you have a suggestion for a better way to accomplish what I'm trying to do, that would be awesome :-)