0

So, I have a submodule that I'm trying to convert into a subtree. Disclaimer: I'm new to using subtrees.

During my testing, I made a change in a file (changed 'foo' to 'bar') and pushed it via the subtree. Seemed to work.

Then I went to the remote and undid that change (changed 'bar' to 'foo') with a new commit. So far so good.

Then I went back to my local repo, pulled the subtree, and... nothing.

My best guess is that it's merging the (older, foo->bar) change on the local to the (newer, bar->foo) change on the remote, and for some reason deciding that the older one should override the newer one, which leaves the code with 'bar'.

Why is this happening, and can/should/how do I get it to stop?


EDIT: Adding the actual steps being done.

1) Add SubTree from SourceTree:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks subtree add -P MySubtree --squash {cloneUrl} master
git fetch {cloneUrl} master
From {cloneUrl}
* branch              master     -> FETCH_HEAD
Added dir 'MySubtree'

2) Make change to code

3) $ git commit -am "SubtreeTest - add change"

4) Push to SubTree using SourceTree:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks subtree push -P MySubtree --squash {cloneUrl} master
git push using:  {cloneUrl} master

5) Directly on BitBucket, make a new commit that undoes the last one.

6) Pull from SubTree in SourceTree:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks subtree pull -P MySubtree --squash {cloneUrl} master
warning: no common commits
From {cloneUrl}
* branch              master     -> FETCH_HEAD
Auto-merging SubTree/BSC/Constants.cs
Merge made by the 'recursive' strategy.
Completed successfully.
Sarov
  • 545
  • 6
  • 17
  • That doesn't sound right... can you redo this workflow and show us the exact command line and output? – Anthony Mastrean Feb 21 '20 at 20:47
  • @AnthonyMastrean It's been a while and I think I deleted the branch that had the subtree. I'll try to remember to do that on Monday. – Sarov Feb 21 '20 at 21:01
  • @AnthonyMastrean Added the commands. Thinking on it, it's probably some setting in SourceTree somewhere. – Sarov Feb 25 '20 at 16:39

0 Answers0