首页 > 其他 > 详细

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

时间:2015-12-30 13:10:17      阅读:218      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!