git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cloning into an existing, non-empty directory?
@ 2011-04-21 21:27 Richard Hartmann
  2011-04-21 22:03 ` Jonathan Nieder
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Hartmann @ 2011-04-21 21:27 UTC (permalink / raw)
  To: Git List

Hi all,

I know that the manpage explicitly states that it's not possible to
clones into an existing, non-empty directory, but I wanted to see if
anyone is aware of a workaround or if I can convince people that is it
of use in specific circumstances.

Some of you will be keeping their RC files in git repo(s) which means
you are basically left with two options:

1) Use soft-/hardlinks
2) Change your working tree

I went for option two which looks like:

richih@roadwarrior ~/.config/vcsh/repo.d/mr.git % ls -a
.   branches        config       FETCH_HEAD  hooks  info  objects    packed-refs
..  COMMIT_EDITMSG  description  HEAD        index  logs  ORIG_HEAD  refs
richih@roadwarrior ~/.config/vcsh/repo.d/mr.git % cat config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	worktree = /home/richih/
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = <remote>
[branch "master"]
	remote = origin
	merge = refs/heads/master
richih@roadwarrior ~/.config/vcsh/repo.d/mr.git %

This works just fine as long as you're using

  git --work-tree=$HOME \
    --git-dir=$HOME/.config/vcsh/repo.d/mr.git \
    pull

or similar on an existing, manually mangled repo. The only real
problem left is that I can't clone initially as $HOME is obviously
non-empty, resulting in

  git --work-tree=$HOME \
    --git-dir=$HOME/.config/vcsh/repo.d/mr.git \
    clone <remote> .config/vcsh/repo.d/mr.git
fatal: working tree '/home/richih' already exists.

This means I am down to cloning, creating the directories I need,
moving .git and the actual files around, making git aware that tracked
files were not deleted, just moved, and then finally being able to use
my repo.

Obviously, this would imply some sort of conflict handling during cloning.

Anyway, I would _really_ love to have a way to avoid all this manual
work and just clone into $HOME, telling git that it's OK and I know
what I am doing.


Thanks,
Richard

PS: In case you are interested in keeping your RC files (and the rest
of your life) in git, there's a vcs-home mailing list and #vcs-home on
irc.oftc.net.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-04-25 18:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 21:27 Cloning into an existing, non-empty directory? Richard Hartmann
2011-04-21 22:03 ` Jonathan Nieder
2011-04-22 11:21   ` Richard Hartmann
2011-04-23 10:15     ` Jonathan Nieder
2011-04-23 10:28       ` Nguyen Thai Ngoc Duy
2011-04-23 10:37         ` Jonathan Nieder
2011-04-23 22:11       ` Richard Hartmann
2011-04-25  8:00         ` Jonathan Nieder
2011-04-25  8:40           ` Andreas Schwab
2011-04-25  8:59             ` Jonathan Nieder
2011-04-25 18:37               ` Jeff King
2011-04-25 14:08           ` Richard Hartmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).