-1

Usually the way I do renames to make sense for myself is -

$ git clone <remote URL.git>
$ mv remotedir nameIwant 

I was wondering if there is a better way to do it.

The reason is sometimes I wanna try some of the forks and wanna keep the main repo. as pristine and the forks also renamed from where they came from. I do know that in ~/.git/config of the repo you can get the remote path but its easier to remember this way.

Is there a better way to do that ?

I did searches on the web but couldn't find anything which helped me.

shirish
  • 12,356
  • I searched "git clone directory name" and got https://stackoverflow.com/questions/651038/how-do-you-clone-a-git-repository-into-a-specific-folder https://stackoverflow.com/questions/47676730/how-to-clone-a-directory-with-different-name-locally-with-git-sourcetree https://stackoverflow.com/questions/8570636/change-name-of-folder-when-cloning-from-github https://stackoverflow.com/questions/42160725/clone-a-git-repository-with-another-name as the first four links – muru Sep 20 '18 at 07:24

1 Answers1

2

Try specifying the desired name of the target directory after your command, e.g.,

git clone <remote URL.git> nameIwant

From man git-clone:

<directory>
    The name of a new directory to clone into. The "humanish" part of
    the source repository is used if no directory is explicitly given
    (repo for /path/to/repo.git and foo for host.xz:foo/.git). Cloning
    into an existing directory is only allowed if the directory is
    empty.