git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brent Goodrick <bgoodr@gmail.com>
To: git@vger.kernel.org
Subject: Cloning into an existing directory
Date: Sun, 15 Feb 2009 23:10:45 -0800	[thread overview]
Message-ID: <e38bce640902152310x195a14e5p445817bdfc6e319f@mail.gmail.com> (raw)

Hi,

I would like to manage my startup scripts such as .bashrc and other
setup files relative to my HOME directory using Git. However,
git-clone disallows cloning into the existing "." directory, but only
allows cloning into a subdirectory that does not yet exist.  If my
home directory is /home/brentg and my remote repository is on
remote_machine:~brentg/my_setup.git then git clone in my home
directory on the local machine creates /home/brentg/my_setup with
files such as .bashrc inside it, which is not what I want. I want them
checked out and managed _in_ the current working directory, and not to
mess with other files or directories that already exist that are never
to be managed by git.

I don't want to create softlinks from files in the HOME directory down
into the subdirectory (e.g., /home/brentg/.bashrc -->
my_setup/.bashrc) if I can at all avoid it, since then to do so for
all of my setup would require extra scripting work, and it may be the
case that some setup files are required to be regular files and not
symbolic links by certain programs.  Moving the files manually is also
out of the question, since then I can't do a git diff operation on the
file directly.

I did see the --bare option to clone, but the entry in the git-clone
man page implies that using that option turns off a lot of tracking of
things that I believe I will need:

       --bare
           Make a bare GIT repository. That is, instead of creating
<directory> and placing the administrative files in
           <directory>/.git, make the <directory> itself the $GIT_DIR.
This obviously implies the -n because there is nowhere to check
           out the working tree. Also the branch heads at the remote
are copied directly to corresponding local branch heads, without
           mapping them to refs/remotes/origin/. When this option is
used, neither remote-tracking branches nor the related
           configuration variables are created.

Specifically, the statement: "branch heads at the remote are copied
directly to corresponding local branch heads, without mapping them to
refs/remotes/origin" and "neither remote-tracking branches nor the
related configuration variables are created" are what is scaring me
off.

Is there a way do to this, or is the --bare option really what I need
here? If so, what are the caveats of the use of that option given the
above "scary" statements.

What is interesting to note, is that git clone on a local repository
to "." seems to work just fine. It is only when cloning from remote
repositories that it complains about the target being an existing
directory.

Thanks,
bg

             reply	other threads:[~2009-02-16  7:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  7:10 Brent Goodrick [this message]
2009-02-16  7:31 ` Cloning into an existing directory Russell Steicke
2009-02-16 16:13   ` Brent Goodrick
2009-02-16 16:48     ` Andrew Ruder
2009-02-17  2:53       ` Brent Goodrick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e38bce640902152310x195a14e5p445817bdfc6e319f@mail.gmail.com \
    --to=bgoodr@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).