Hi,
I had a particular notion of what rebase -X subtree would do but I am apparently mistaken. What should be the result of the script below? I expected commits to be replayed on top of master with their trees adjusted to move files into a "files" directory. In the first case, the rebase seems to have done nothing. In the second case I get an error:
First, rewinding head to replay your work on top of it... fatal: Could not parse object '6c0826e4cf4b1f44ebafbd4084c1f0066a59d112^' Unknown exit code (128) from command: git-merge-recursive 6c0826e4cf4b1f44ebafbd4084c1f0066a 59d112^ -- HEAD 6c0826e4cf4b1f44ebafbd4084c1f0066a59d112
If "files" exists and I use rebase -X subtree it replays the commits, moving trees out from under "files," as I would expect. Is it not possible to use git rebase to move trees under a new subdirectory?
I know that I can use filter-branch to accomplish what I want, I'm just curious whether git rebase is expected to behave as I thought. At the very least, it seems a better error message in the orphan branch case would be helpful.
Thanks for you help!
-David
#!/bin/bash
function addfile {
name=$1
echo ${name} > ${name}
git add ${name}
git commit -m "Add ${name}"
}mkdir rebasetest1 cd rebasetest1 git init
addfile README
git checkout -b work
addfile file1
git rebase -X subtree=files --onto master master
cd ..
mkdir rebasetest2 cd rebasetest2 git init
addfile README
git checkout --orphan work
addfile file1
git rebase -X subtree=files --onto master --root