命令格式

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

命令参数

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

实例

a) 创建版本库

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

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

[huey@huey-K42JE git]$ mkdir hello_world
[huey@huey-K42JE git]$ echo -e '#!/usr/bin/python\nprint "hello world"' > hello_world/hello.py
[huey@huey-K42JE git]$ chmod a+x hello_world/hello.py
[huey@huey-K42JE git]$ cd hello_world/
[huey@huey-K42JE hello_world]$ git init
Initialized empty Git repository in /home/huye/git/hello_world/.git/
[huey@huey-K42JE hello_world]$ git add .
[huey@huey-K42JE 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

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. LCA + 二分(倍增)

    两个最近的点u和v的最近的公共的祖先称为最近公共祖先(LCA).普通的LCA算法,每算一次LCA的时间复杂度为线性o(n); 这里讲LCA + 二分的方法.首先对于任意的节点v,利用其父节点的信息,可 ...

  2. HDU 2045 不容易系列之(3)—— LELE的RPG难题 (递推)

    题意:略. 析:首先是假设前n-2个已经放好了,那么放第 n 个时,先考虑一下第 n-1 放的是什么,那么有两种情况. 如果n-1放的是和第1个一样的,那么第 n 个就可以在n-2的基础上放2个,也就 ...

  3. linux 查看当前所在目录的全路径

    有时候,使用linux的shell的时候需要查看当前位置的全路径,可以使用 pwd命令 当然,知道了该命令就可以通过man pwd来查看该命令的全部帮助手册.

  4. TypeScript学习笔记(七):模块

    JavaScript中的模块 在学习TypeScript的模块之前我们先看看在JavaScript中的模块是如何实现的. 模块的好处 首先我们要了解使用模块的好处都有什么? 模块化.可重用: 封装变量 ...

  5. C#学习笔记(七):智能编译器

    自动实现属性 C#提供的set/get可以让我们很方便的使用属性,但是某些情况下书写还是稍微麻烦了点,如下: public class Test { private string _name; pub ...

  6. 在VB中使用Linq To SQLite注意事项

    昨天使Linq To SQLite 支持VB,今天在VB中写了几条Linq语句,发现了几个问题: 1.在Linq To SQLite中的Linq语句查询后并不是得到的匿名数据类,而是将Linq转换为S ...

  7. Oracle-11g-R2(11.2.0.3.x)RAC Oracle Grid & Database 零宕机方式升级 PSU(自动模式)

    升级环境: 1.源库版本: Grid Infrastructure:11.2.0.3.13 Database:11.2.0.3.13 2.目标库版本: Grid Infrastructure:11.2 ...

  8. sunlime text 3 快捷键总结

    Ctrl+D 选中光标所占的文本,继续操作则会选中下一个相同的文本. Alt+F3 选中文本按下快捷键,即可一次性选择全部的相同文本进行同时编辑.举个栗子:快速选中并更改所有相同的变量名.函数名等. ...

  9. ServletContext2

    ------------ContextServlet.java--------------节选-- protected void doGet(HttpServletRequest request, H ...

  10. ADO.NET 快速入门(三):从存储过程获取输出参数

    一些存储过程通过参数返回值.当参数在SQL表达式或者存储过程中被定义为“输出”,参数值会返回给调用者.返回值存储在 OleDbCommand 或者 SqlCommand 对象的参数集合的参数里.   ...