Re: Cloning into an existing directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote:
> On 2/16/09, Brent Goodrick <bgoodr@xxxxxxxxx> 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.
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux