Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_init [2018/05/30 12:25] – [Running git init in an existing repository] rpjdaygit_init [2019/02/21 12:57] (current) – [Overview (not quite done here)] rpjday
Line 1: Line 1:
-===== Overview =====+===== Overview (not quite done here) =====
  
-Basic operation of creating new repo or enhancing an existing repo with ''git init''.+Basic and advanced features for initializing Git repository -- more content to be added.
  
-===== Default content of new .git directory =====+===== Working with the template directory ===== 
 + 
 +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:
  
 <code> <code>
 . .
-├── branches +├── branches/
-├── config+
 ├── description ├── description
-├── HEAD +├── hooks/ 
-├── hooks +│   ├── applypatch-msg.sample* 
-│   ├── applypatch-msg.sample +│   ├── commit-msg.sample* 
-│   ├── commit-msg.sample +│   ├── fsmonitor-watchman.sample* 
-│   ├── fsmonitor-watchman.sample +│   ├── post-update.sample* 
-│   ├── post-update.sample +│   ├── pre-applypatch.sample* 
-│   ├── pre-applypatch.sample +│   ├── pre-commit.sample* 
-│   ├── pre-commit.sample +│   ├── prepare-commit-msg.sample* 
-│   ├── prepare-commit-msg.sample +│   ├── pre-push.sample* 
-│   ├── pre-push.sample +│   ├── pre-rebase.sample* 
-│   ├── pre-rebase.sample +│   ├── pre-receive.sample* 
-│   ├── pre-receive.sample +│   └── update.sample* 
-│   └── update.sample +└── info/ 
-├── info +    └── exclude
-│   ── exclude +
-├── objects +
-│   ├── info +
-│   └── pack +
-└── refs +
-    ├── heads +
-    └── tags+
 </code> </code>
  
-===== Running "git init" in an existing repository =====+Rather than accepting the default directory and content, it's common for developers to want to immediately register their own hooks, which means setting up an alternate template directory. 
 + 
 +From the man page for "git init'':
  
 <code> <code>
-Running git init in an existing repository is safe. It will not +TEMPLATE DIRECTORY 
-overwrite things that are already there. The primary reason for +   Files and directories in the template directory whose name do 
-rerunning git init is to pick up newly added templates (or to +   not start with a dot will be copied to the $GIT_DIR after it is 
-move the repository to another place if --separate-git-dir is +   created.
-given). +
-</code>+
  
-===== Working with the template directory =====+   The template directory will be one of the following (in order):
  
-By default, ''git init'' will populate your new ''.git'' directory with the contents of ''/usr/share/git-core/templates/'', without overwriting existing content of the same name:+   ·   the argument given with the --template option;
  
-<code> +   ·   the contents of the $GIT_TEMPLATE_DIR environment variable; 
-├── branches + 
-├── description +   ·   the init.templateDir configuration variable; or 
-├── hooks + 
-│   ├── applypatch-msg.sample +   ·   the default template directory: 
-│   ├── commit-msg.sample +       /usr/share/git-core/templates
-│   ├── fsmonitor-watchman.sample + 
-│   ├── post-update.sample +   The default template directory includes some directory 
-│   ├── pre-applypatch.sample +   structure, suggested "exclude patterns" (see gitignore(5)), and 
-│   ├── pre-commit.sample +   sample hook files
-│   ├── prepare-commit-msg.sample + 
-│   ├── pre-push.sample +   The sample hooks are all disabled by default, To enable one of 
-│   ├── pre-rebase.sample +   the sample hooks rename it by removing its .sample suffix.
-│   ├── pre-receive.sample +
-│   └── update.sample +
-└── info +
-    └── exclude+
 </code> </code>
  • git_init.1527683151.txt.gz
  • Last modified: 2018/05/30 12:25
  • by rpjday