Re: Merging a foreign tree into a bare repository.
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Jul 9, 2008, 17:27 UTC
- Message-ID
- <m3lk0bdkyl.fsf@localhost.localdomain>
- In-Reply-To
- <alpine.DEB.1.00.0807090238561.5277@eeepc-johanness>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 13 quoted lines
> On Tue, 8 Jul 2008, Dave Quigley wrote:
>
> > I tried to then merge them but you need a working directory to merge the
> > changes which makes sense.
>
> Of course it does. Merging runs the risk of conflicts, and you need a
> working directory for that.
>
> > How would one go about doing this with a bare repository?
>
> Very easy: clone it ("non-barely"), merge, and push back the results.
>
> You _need_ a working directory for the merge.Or, alternatively, you can tell git where you want to have working directory with '--work-tree' parameter to git wrapper, for example
1451:jnareb@roke:/tmp/jnareb> git clone --bare test/ test-clone.git Initialize test-clone.git Initialized empty Git repository in /tmp/jnareb/test-clone.git/
(Hmmm... I hope the last message, which is unnecessary and I think is just spillage from git-init, would vanish in builting git-clone)
1453:jnareb@roke:/tmp/jnareb/test-clone.git> ls
branches config description HEAD hooks info objects refs
1454:jnareb@roke:/tmp/jnareb/test-clone.git> cat config
[core]
repositoryformatversion = 0
filemode = true
bare = true(It is bare repository) 1461:jnareb@roke:/tmp/jnareb/test-clone.git> git checkout fatal: This operation must be run in a work tree
(You would get the same error with merge and with rebase)
1458:jnareb@roke:/tmp/jnareb/test-clone.git> git --work-tree=../test-workdir/ checkout 1459:jnareb@roke:/tmp/jnareb/test-clone.git> ls ../test-workdir/ foo
It works!
You can also set core.worktree configuration variable... although I don't know what git would do if core.bare is true and core.worktree is set.
HTH
-- Jakub Narebski Poland ShadeHawk on #git