码迷,mamicode.com
首页 > 其他好文 > 详细

Git CMD - init: Create an empty Git repository or reinitialize an existing one

时间:2015-12-30 13:12:26      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

命令格式

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

标签:

原文地址:http://www.cnblogs.com/huey/p/5088276.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!