{"thread":{"id":"40913","subject":"rebase -X subtree","startedAt":"2015-12-01T02:22:46Z","lastAt":"2015-12-01T02:22:46Z","messageCount":1,"participants":["David A. Greene"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"273852","messageId":"87lh9e9abt.fsf@waller.obbligato.org","threadId":"40913","inReplyTo":null,"subject":"rebase -X subtree","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2015-12-01T02:22:46Z","receivedAt":"2015-12-01T02:22:46Z","isPatch":false,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"Hi,\n\nI had a particular notion of what rebase -X subtree would do but I am\napparently mistaken.  What should be the result of the script below?  I\nexpected commits to be replayed on top of master with their trees\nadjusted to move files into a \"files\" directory.  In the first case, the\nrebase seems to have done nothing.  In the second case I get an error:\n\nFirst, rewinding head to replay your work on top of it...\nfatal: Could not parse object '6c0826e4cf4b1f44ebafbd4084c1f0066a59d112^'\nUnknown exit code (128) from command: git-merge-recursive 6c0826e4cf4b1f44ebafbd4084c1f0066a\n59d112^ -- HEAD 6c0826e4cf4b1f44ebafbd4084c1f0066a59d112                                   \n\nIf \"files\" exists and I use rebase -X subtree it replays the commits,\nmoving trees out from under \"files,\" as I would expect.  Is it not\npossible to use git rebase to move trees under a new subdirectory?\n\nI know that I can use filter-branch to accomplish what I want, I'm just\ncurious whether git rebase is expected to behave as I thought.  At the\nvery least, it seems a better error message in the orphan branch case\nwould be helpful.\n\nThanks for you help!\n\n                      -David\n\n#!/bin/bash\n\nfunction addfile {\n    name=$1\n    echo ${name} > ${name}\n    git add ${name}\n    git commit -m \"Add ${name}\"\n}\n\nmkdir rebasetest1\ncd rebasetest1\ngit init\n\naddfile README\n\ngit checkout -b work\n\naddfile file1\n\ngit rebase -X subtree=files --onto master master\n\ncd ..\n\nmkdir rebasetest2\ncd rebasetest2\ngit init\n\naddfile README\n\ngit checkout --orphan work\n\naddfile file1\n\ngit rebase -X subtree=files --onto master --root\n"}]}