On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller <sbeller@xxxxxxxxxx> wrote: > diff --git a/dir.c b/dir.c > index 8b74997c66..cc5729f733 100644 > --- a/dir.c > +++ b/dir.c > @@ -2774,3 +2774,15 @@ void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir) > free(real_work_tree); > free(real_git_dir); > } > + > +/* > + * Migrate the git directory of the given path from old_git_dir to new_git_dir. > + */ > +void relocate_gitdir(const char *path, const char *old_git_dir, const char *new_git_dir) > +{ > + if (rename(old_git_dir, new_git_dir) < 0) > + die_errno(_("could not migrate git directory from '%s' to '%s'"), > + old_git_dir, new_git_dir); > + > + connect_work_tree_and_git_dir(path, new_git_dir); > +} Thank you! -- Duy