Monday, March 26, 2012

git: Rename the Directory Containing a Repository

When we thought about doing this it seemed like it was going to be a big deal but it turned out to be pretty simple. The following steps accomplished what was necessary:

1. Modify gitosis.conf to add the new directory

[group foo]
writable = foo
members = @developers

[group foo_readonly]
readonly = foo
members = @designers @developers

[group bar]
writable = bar
members = @developers

[group bar_readonly]
readonly = bar
members = @designers @developers

2. mv oldDir newDir

On origin, run the bash 'mv' command
mv foo bar

3. Work with new code

On my development machine, run git clone on the new directory and start working with the files. In our case we were using the old directory name for a new project. Running git pull from my development machine created an empty git repository on origin with the old directory name.

No comments:

Post a Comment