I found a related question below, but can't understand 'pick up newly added templates', and seems this explaination was removed in latest http://git-scm.com/docs/git-init
Does running git init twice initialize a repository or reinitialize an existing repo?
Running git init in an existing repository is safe. It will not overwrite things that are already there. The primary reason for rerunning git init is to pick up newly added templates.
I just don't know what will reinitialize actually do, hope someone can explain it detail, thanks a lot :)
The same git init documentation has this to say about templates:
Template directory
The template directory contains files and directories that will be copied to the
$GIT_DIRafter it is created.The template directory will be one of the following (in order):
the argument given with the
--templateoption;the contents of the
$GIT_TEMPLATE_DIRenvironment variable;the
init.templatedirconfiguration variable; orthe default template directory:
/usr/share/git-core/templates.The default template directory includes some directory structure, suggested "exclude patterns" (see gitignore[5]), and sample hook files (see githooks[5]).
So if you have manually changed the files in /usr/share/git-core/templates, or possibly upgraded to a new version of Git that came with different templates, reinitializing will copy those new files into an existing repository.
The documentation also suggests another reason for reinitializing:
to move the repository to another place if
--separate-git-diris given
And later:
--separate-git-dir=<git dir>Instead of initializing the repository as a directory to either
$GIT_DIRor./.git/, create a text file there containing the path to the actual repository. This file acts as filesystem-agnostic Git symbolic link to the repository.If this is reinitialization, the repository will be moved to the specified path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With