This is an old revision of the document!


Basic operation of creating a new repo.

By default, git init will populate your new .git directory with some auto-generated content, plus all of the content of the appropriate template directory.

If you don't specify a template directory, the default used is /usr/share/git-core/templates, which contains something like this:

.
├── branches/
├── description
├── hooks/
│   ├── applypatch-msg.sample*
│   ├── commit-msg.sample*
│   ├── fsmonitor-watchman.sample*
│   ├── post-update.sample*
│   ├── pre-applypatch.sample*
│   ├── pre-commit.sample*
│   ├── prepare-commit-msg.sample*
│   ├── pre-push.sample*
│   ├── pre-rebase.sample*
│   ├── pre-receive.sample*
│   └── update.sample*
└── info/
    └── exclude

You have the option of selecting a different template directory when you run git init:

TEMPLATE DIRECTORY
       Files and directories in the template directory whose name do
       not start with a dot will be copied to the $GIT_DIR after it is
       created.

       The template directory will be one of the following (in order):

       ·   the argument given with the --template option;

       ·   the contents of the $GIT_TEMPLATE_DIR environment variable;

       ·   the init.templateDir configuration variable; or

       ·   the 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.

       The sample hooks are all disabled by default, To enable one of
       the sample hooks rename it by removing its .sample suffix.
  • git_init.1550486478.txt.gz
  • Last modified: 2019/02/18 10:41
  • by rpjday