我想通过自动创建.gitignore,README,LICENSE和其他git init命令文件来优化我的git工作流程.
要做到这一点,我git init在http://git-scm.com/docs/git-init的 RTFM,它告诉我做以下其中一项:
git init --template=<template_directory>,但这很麻烦.init.templatedir配置变量.现在我们正在谈论!所以我sudo mkdir /usr/share/git-core/templates/my_template和touch它中的一些文件,然后我vim ~/.gitconfig和追加:
[init]
templatedir = /usr/share/git-core/templates/my_template
Run Code Online (Sandbox Code Playgroud)
并git config -l告诉我:
...
init.templatedir =/usr/share/git-core/templates/my_template
...
对自己感到高兴,我去了我的开发游乐场目录,并且:
$ git init
Initialized empty Git repository in /the/current/directory
$ ls -a
. .. .git
Run Code Online (Sandbox Code Playgroud)
糟糕......文件在哪里?:(
快速检查:
$ ls -a /usr/share/git-core/templates/my_template
. .. .gitignore LICENSE README.md
$ git --version
git version 1.8.2.1
Run Code Online (Sandbox Code Playgroud)
它似乎$ git init …