# contrib/git-normal-to-bare.sh

5 messages from 2013-05-27 to 2013-05-29. Participants: Zenaan Harkness, Matthieu Moy, Fredrik Gustafsson, Felipe Contreras.
Thread: https://gitlist.dev/t/33944

## Zenaan Harkness, 2013-05-27 04:00

Subject: contrib/git-normal-to-bare.sh
Message-ID: <CAOsGNSSFx7VEOmz4qTt9nz=SXzQCZH7PdZ+gnYVqLhmRmRcT-A@mail.gmail.com>
URL: https://gitlist.dev/e/CAOsGNSSFx7VEOmz4qTt9nz%3DSXzQCZH7PdZ%2BgnYVqLhmRmRcT-A%40mail.gmail.com

```
This question comes up every now and then - how to convert from normal
to bare, or vice versa.

This is just a start to a basic script to go one way. Needs more tests
etc, but it's enough to get newbies (like me) off to a reasonable
start.

PLEASE CC me, as I am not subscribed.

Thanks,
Zenaan

```

## Matthieu Moy, 2013-05-27 09:02

Subject: Re: contrib/git-normal-to-bare.sh
Message-ID: <vpqr4gs23u6.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqr4gs23u6.fsf%40anie.imag.fr
In-Reply-To: <CAOsGNSSFx7VEOmz4qTt9nz=SXzQCZH7PdZ+gnYVqLhmRmRcT-A@mail.gmail.com>

```
Zenaan Harkness <zen@freedbms.net> writes:

>    rm -rf $repo

The user would appreciate if you check that there are no uncommited
changes and no untracked files (at least no untracked and not ignored
files) before running this.

Also, it's "$repo", not just $repo, or you'll get surprising behavior if
$repo contain spaces.

The safe way would actually be stg like:

  rm -fr -- "$repo"

in case $repo starts with a dash.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Zenaan Harkness, 2013-05-27 09:43

Subject: Re: contrib/git-normal-to-bare.sh
Message-ID: <CAOsGNSRm8QChOupsY_Z++qDOMh4hXq-9A_Z2X6uY5o-tFMNj0A@mail.gmail.com>
URL: https://gitlist.dev/e/CAOsGNSRm8QChOupsY_Z%2B%2BqDOMh4hXq-9A_Z2X6uY5o-tFMNj0A%40mail.gmail.com
In-Reply-To: <vpqr4gs23u6.fsf@anie.imag.fr>

```
On 5/27/13, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
> Zenaan Harkness <zen@freedbms.net> writes:
>
>>    rm -rf $repo
>
> The user would appreciate if you check that there are no uncommited
> changes and no untracked files (at least no untracked and not ignored
> files) before running this.
>
> Also, it's "$repo", not just $repo, or you'll get surprising behavior if
> $repo contain spaces.
>
> The safe way would actually be stg like:
>
>   rm -fr -- "$repo"

Thanks.

In my later email, I changed it to mv - should have highlighted there
was a change. I got bitten, on a small repo thankfully, where a perms
or ownership problem caused the whole repo to disappear. So mv it is
:)

BTW, I've subscribed for a little while now...

Thanks again
Zenaan

```

## Fredrik Gustafsson, 2013-05-27 09:52

Subject: Re: contrib/git-normal-to-bare.sh
Message-ID: <20130527095240.GA530@paksenarrion.iveqy.com>
URL: https://gitlist.dev/e/20130527095240.GA530%40paksenarrion.iveqy.com
In-Reply-To: <CAOsGNSRm8QChOupsY_Z++qDOMh4hXq-9A_Z2X6uY5o-tFMNj0A@mail.gmail.com>

```
On Mon, May 27, 2013 at 07:43:13PM +1000, Zenaan Harkness wrote:
> In my later email, I changed it to mv - should have highlighted there
> was a change. I got bitten, on a small repo thankfully, where a perms
> or ownership problem caused the whole repo to disappear. So mv it is
> :)

Do you really need bash for that script or will it do with sh? I think
sh is preferred.

Also a mv instead of a rm will require a lot of disc space if you have a
big repository.

-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com

```

## Felipe Contreras, 2013-05-29 02:52

Subject: RE: contrib/git-normal-to-bare.sh
Message-ID: <51a56d80d8a59_8bf138be1c906c6@nysa.mail>
URL: https://gitlist.dev/e/51a56d80d8a59_8bf138be1c906c6%40nysa.mail
In-Reply-To: <CAOsGNSSFx7VEOmz4qTt9nz=SXzQCZH7PdZ+gnYVqLhmRmRcT-A@mail.gmail.com>

```
Zenaan Harkness wrote:
> This question comes up every now and then - how to convert from normal
> to bare, or vice versa.
> 
> This is just a start to a basic script to go one way. Needs more tests
> etc, but it's enough to get newbies (like me) off to a reasonable
> start.
> 
> PLEASE CC me, as I am not subscribed.

You do not need to ask to be CC'ed. Any mailing list properly configued would
not munge the Reply-To header, so anybody replying to this mail would reply to
you.

Git is a properly configured mailing list, just like all the mailing list in
vger.kernel.org.

Cheers.

-- 
Felipe Contreras

```
