I have a git repo in /srv/git/mysite.git.
Workdir is set to
/srv/www/mysite
in git /srv/git/mysite.git/config:
[core] repositoryformatversion = 0
filemode = false
bare = false
worktree = /srv/www/mysite
[receive] denyCurrentBranch = updateInstead
I would like to split with subtree the directory content at:
/srv/www/mysite/mysubsite
to branch mysubsite.
When I execute:
cd /srv/git/mysite.git
git subtree split --prefix=mysubsite -b mysubsite
I get error
You need to run this command from the toplevel of the working tree.
It seems this thread has related info about my problem: http://git.661346.n2.nabble.com/git-users-Problem-using-detached-worktrees-with-commands-implemented-in-scripts-td7597786.html
I tried the following:
export GIT_WORK_TREE=/srv/www/mysite
export GIT_DIR=/srv/git/mysite.git
cd /srv/www/mysite
git subtree split --prefix=mysubsite -b mysubsite
I get error again:
You need to run this command from the toplevel of the working tree.
How can I fix this?
Works for me, export GIT_DIR
was enough.
$ git --version
git version 2.11.0
Also this works:
$ cd /srv/www/mysite
$ git --git-dir=/srv/git/mysite.git subtree split --prefix=mysubsite -b mysubsite