命令格式

git init [-q | --quiet] [--bare] [--template=<template_directory>]
    [--separate-git-dir <git dir>]
    [--shared[=<permissions>]] [directory]

命令参数

--quiet, -q
  安静模式,只打印错误和警告信息。

实例

a) 创建版本库

  1. [huey@huey-K42JE git]$ mkdir hello_git
  2. [huey@huey-K42JE git]$ cd hello_git/
  3. [huey@huey-K42JE hello_git]$ git init
  4. Initialized empty Git repository in /home/ucm/git/hello_git/.git/

b) 为已存在的代码库创建版本库

  1. [huey@huey-K42JE git]$ mkdir hello_world
  2. [huey@huey-K42JE git]$ echo -e '#!/usr/bin/python\nprint "hello world"' > hello_world/hello.py
  3. [huey@huey-K42JE git]$ chmod a+x hello_world/hello.py
  4. [huey@huey-K42JE git]$ cd hello_world/
  5. [huey@huey-K42JE hello_world]$ git init
  6. Initialized empty Git repository in /home/huye/git/hello_world/.git/
  7. [huey@huey-K42JE hello_world]$ git add .
  8. [huey@huey-K42JE hello_world]$ git commit -m "Start a new Git repository for an existing code base"
  9. [master (root-commit) b65bd46] Start a new Git repository for an existing code base
  10. 1 files changed, 2 insertions(+), 0 deletions(-)
  11. create mode 100755 hello.py

更多

http://git-scm.com/docs/git-init

Git CMD - init: Create an empty Git repository or reinitialize an existing one的更多相关文章

  1. Git CMD - add: Record changes to the repository

    命令格式 git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend] [--dry-run] [(-c ...

  2. Git CMD - tag: Create, list, delete or verify a tag object signed with GPG

    命令格式 git tag [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] <tagname> [& ...

  3. 指定文件夹 指定文件后缀名 删除整个文件夹 git 冲突解决 create a new repository on the command line push an existing repository from the command line

    http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001375840038939c2 ...

  4. Git CMD - clone: Clone a repository into a new directory

    命令格式 git clone [--template=<template_directory>]  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare ...

  5. Git CMD连接,管理(remote,add,commit,push)github repository

    git initmd testcd testgit statusgit add test  //git add test/a.txtgit status git remote add origin g ...

  6. git clone all branch and create a empty branch

    /******************************************************************** * git clone all branch and cre ...

  7. Git CMD - config: Get and set repository or global options

    命令参数 --get 获取指定的配置项. --global 对于写选项:全局配置,将参数配置于 ~/.gitconfig 而不是仓库目录下的 .git/config.对于读选项:只从 ~/.gitco ...

  8. Git CMD - branch: List, create, or delete branches

    命令格式 git branch [--color[=<when>] | --no-color] [-r | -a] [--list] [-v [--abbrev=<length> ...

  9. git错误:fatal: Not a git repository (or any of the parent directories): .git

    git错误:fatal: Not a git repository (or any of the parent directories): .git 我用git add file添加文件时出现这样错误 ...

随机推荐

  1. CodeForces 706B Interesting drink (二分查找)

    题意:给定 n 个数,然后有 m 个询问,每个询问一个数,问你小于等于这个数的数有多少个. 析:其实很简单么,先排序,然后十分查找,so easy. 代码如下: #pragma comment(lin ...

  2. hdu 4781 Assignment For Princess (2013ACMICPC 成都站 A)

    http://acm.hdu.edu.cn/showproblem.php?pid=4781 由于题目太长,这里就不直接贴了,直接说大意吧. 题目大意:有一个n个点,m条边的有向图,每条边的权值分别为 ...

  3. Usage of readonly and const

    Many new learners can not make sure the usage scenarios of readonly and const keywords. In my opinio ...

  4. ubuntu 如何在recovery模式修改root密码

    今天遇到一个问题, 前提1: ubuntu系统的root密码我一直没有设定  前提2: ubuntu初始创建的sudo用户不知道怎么移除sudo权限用户了. 下面就精彩了, 首先没有root密码,你不 ...

  5. 使用jdk操作 wsdl2java (wedservice)

    打开jdk下的bin目录 看下能否找到"wsimport.exe"这个文件 一般情况下都会有 如果没有则说明你的JDK不支持这个功能 然后在DOS窗口下输入wsimport 敲回车 ...

  6. 正则表达式从右往左进行匹配(Regex)

    #匹配最末两位为数字 $x=New-Object regex ('\d{2}','RightToLeft') #$x.RightToLeft $x.Match('abcd22') 结果:

  7. Codeforces Round #334 (Div. 2) B. More Cowbell 二分

    B. More Cowbell Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/probl ...

  8. Codeforces Round #192 (Div. 1) A. Purification 贪心

    A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...

  9. Codeforces Gym 100002 Problem F "Folding" 区间DP

    Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...

  10. codeforces GYM 100114 J. Computer Network tarjan 树的直径 缩点

    J. Computer Network Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Des ...