命令格式
git init [-q | --quiet] [--bare] [--template=<template_directory>]
[--separate-git-dir <git dir>]
[--shared[=<permissions>]] [directory]
命令参数
--quiet, -q
安静模式,只打印错误和警告信息。
实例
a) 创建版本库
[[email protected] git]$ mkdir hello_git [[email protected] git]$ cd hello_git/ [[email protected] hello_git]$ git init Initialized empty Git repository in /home/ucm/git/hello_git/.git/
b) 为已存在的代码库创建版本库
[[email protected] git]$ mkdir hello_world [[email protected] git]$ echo -e ‘#!/usr/bin/python\nprint "hello world"‘ > hello_world/hello.py [[email protected] git]$ chmod a+x hello_world/hello.py [[email protected] git]$ cd hello_world/ [[email protected] hello_world]$ git init Initialized empty Git repository in /home/huye/git/hello_world/.git/ [[email protected] hello_world]$ git add . [[email protected] hello_world]$ git commit -m "Start a new Git repository for an existing code base" [master (root-commit) b65bd46] Start a new Git repository for an existing code base 1 files changed, 2 insertions(+), 0 deletions(-) create mode 100755 hello.py
更多
http://git-scm.com/docs/git-init
时间: 2024-08-08 22:05:38