threads / discuss / 33944

contrib/git-normal-to-bare.sh

Subject: contrib/git-normal-to-bare.sh

## tl;dr

5 messages between May 27, 2013 and May 29, 2013.

replies: 4people: 4as markdown or json

Zenaan Harkness· May 27, 2013, 04:00 UTC · lore

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· May 27, 2013, 09:02 UTC · re: Zenaan Harkness · lore

Re: contrib/git-normal-to-bare.sh

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· May 27, 2013, 09:43 UTC · re: Matthieu Moy · lore

Re: contrib/git-normal-to-bare.sh

On 5/27/13, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
Show 14 quoted lines
> 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· May 27, 2013, 09:52 UTC · re: Zenaan Harkness · lore

Re: contrib/git-normal-to-bare.sh

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· May 29, 2013, 02:52 UTC · re: Zenaan Harkness · lore

RE: contrib/git-normal-to-bare.sh

Zenaan Harkness wrote:
Show 8 quoted lines
> 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

← back to recent threads