Re: Please consider adding a -f switch to git-clone (or something similar)

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

 



Kyle,

Thanks, I suppose that works well enough for my needs. I wasn't aware
that aliases were that flexible in git.

I also have no problem to git-init and do all the other steps manually.

Thanks,

Diego

On Sat, Mar 7, 2015 at 11:32 PM, Kyle J. McKay <mackyle@xxxxxxxxx> wrote:
> On Mar 7, 2015, at 17:53, Diego Viola wrote:
>>
>> Something like this is the scenario I'm talking about:
>>
>> $ mkdir non-empty-dir
>> $ cd non-empty-dir
>> $ touch foo bar baz
>> $ git clone -f url:user/dotfiles.git .
>> $ git status
>> On branch master
>> Your branch is up-to-date with 'origin/master'.
>> Untracked files:
>>  (use "git add <file>..." to include in what will be committed)
>>
>>    bar
>>    baz
>>    foo
>>
>> nothing added to commit but untracked files present (use "git add" to
>> track)
>
>
> Have you considered using an alias?
>
> git config --global alias.irfc \
>   '!sh -c '\''git init && git remote add origin "$1" && git fetch && git
> checkout "${2:-master}"'\'' sh'
>
> (You'll likely have to carefully unwrap that line above.)
>
> Then you get
>
>   git irfc <URL> [<branch>]
>
> where <branch> defaults to master.
> So your scenario would become just:
>
>
>
> $ mkdir non-empty-dir
> $ cd non-empty-dir
> $ touch foo bar baz
> $ git irfc url:user/dotfiles.git
> $ git status
> On branch master
> Your branch is up-to-date with 'origin/master'.
> Untracked files:
>  (use "git add <file>..." to include in what will be committed)
>
>    bar
>    baz
>    foo
>
> nothing added to commit but untracked files present (use "git add" to track)
>
>
> -Kyle
>
> P.S. irfc = init, remote, fetch, checkout.  But do make up a better name. :)
--
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]