git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brent Goodrick <bgoodr@gmail.com>
To: Russell Steicke <russellsteicke@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Cloning into an existing directory
Date: Mon, 16 Feb 2009 08:13:12 -0800	[thread overview]
Message-ID: <e38bce640902160813u2771d55co3eb583a0922c09c5@mail.gmail.com> (raw)
In-Reply-To: <c1b8b6670902152331p9bbdb8fo7bf7048039b5301c@mail.gmail.com>

Thanks very much for the advice, Russell.

I did a test by creating the small repo with one file in it, .bashrc
and got to the point of the git-fetch. That git-fetch did not complain
about the pre-existing .bashrc file. Should it, or is the design of
git-fetch to alter the state inside the .git area only and not the
working tree?  The scan of the user manual and the git-fetch man page
does not seem to clarify the effect (none?) that git-fetch has on the
working tree.

Now, I see that you said it would complain upon checkout, which it did:

$ git checkout master
error: Untracked working tree file '.bashrc' would be overwritten by merge.

Fair enough: git is doing the right thing here and not overwriting the
target file since it is not yet git-controlled.   Given that I may
have many files, my naive way of fixing that is to

1. Move aside each file it complains about
2. Run the git-checkout command again
3. Move each file back to their original names, thus creating a local
edit w.r.t. git
4. Run git diff to see those changes, making additional edits
5. Finally, check in the result

To side-step writing my own wrapper script around git, is there a
command-line option to do steps 1 through 3, but not 4 and 5?

Thanks again for your help,
bg


On Sun, Feb 15, 2009 at 11:31 PM, Russell Steicke
<russellsteicke@gmail.com> wrote:
> On 2/16/09, Brent Goodrick <bgoodr@gmail.com> wrote:
>> 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.
>
> cd
> git init
> git remote add origin remote_machine:~brentg/my_setup.git
> git fetch
> git branch master origin/master
> git checkout master
>
> You may have to delete .bashrc and others before git will overwrite
> them on checkout.
>
>
>
> --
> Virus found in this message.
>

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  7:10 Cloning into an existing directory Brent Goodrick
2009-02-16  7:31 ` Russell Steicke
2009-02-16 16:13   ` Brent Goodrick [this message]
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=e38bce640902160813u2771d55co3eb583a0922c09c5@mail.gmail.com \
    --to=bgoodr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=russellsteicke@gmail.com \
    /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).