Git工作流程

git对象
这里写图片描述

创建裸仓库和非裸仓库

单凯@shankai MINGW32 /e/gitRepository
$ git init git_non_bare_1
Initialized empty Git repository in E:/gitRepository/git_non_bare_1/.git/

单凯@shankai MINGW32 /e/gitRepository
$ cd git_non_bare_1/.git/

单凯@shankai MINGW32 /e/gitRepository/git_non_bare_1/.git (GIT_DIR!)
$ ls
config  description  HEAD  hooks/  info/  objects/  refs/

单凯@shankai MINGW32 /e/gitRepository/git_non_bare_1/.git (GIT_DIR!)
$ cd ../..

单凯@shankai MINGW32 /e/gitRepository
$ pwd
/e/gitRepository

单凯@shankai MINGW32 /e/gitRepository
$ git init --bare git_bare_1
Initialized empty Git repository in E:/gitRepository/git_bare_1/

单凯@shankai MINGW32 /e/gitRepository
$ cd git_bare_1/
config       HEAD         info/        refs/
description  hooks/       objects/

单凯@shankai MINGW32 /e/gitRepository
$ cd git_bare_1/

单凯@shankai MINGW32 /e/gitRepository/git_bare_1 (BARE:master)
$ ls
config  description  HEAD  hooks/  info/  objects/  refs/

单凯@shankai MINGW32 /e/gitRepository/git_bare_1 (BARE:master)
$
在当前文件夹下创建仓库
单凯@shankai MINGW32 /e/gitRepository
$ mkdir git_init_1

单凯@shankai MINGW32 /e/gitRepository
$ cd git_init_1/

单凯@shankai MINGW32 /e/gitRepository/git_init_1
$ git init
Initialized empty Git repository in E:/gitRepository/git_init_1/.git/

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$

复制一个仓库

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ pwd
/e/gitRepository/git_init_1

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ cd ..

单凯@shankai MINGW32 /e/gitRepository
$ git clone git_bare_1/ git_clone_1
Cloning into 'git_clone_1'...
warning: You appear to have cloned an empty repository.
done.

单凯@shankai MINGW32 /e/gitRepository
$ cd git_clone_1/.git/

单凯@shankai MINGW32 /e/gitRepository/git_clone_1/.git (GIT_DIR!)
$ ls
config  description  HEAD  hooks/  info/  objects/  refs/

单凯@shankai MINGW32 /e/gitRepository/git_clone_1/.git (GIT_DIR!)
$ ^C

单凯@shankai MINGW32 /e/gitRepository/git_clone_1/.git (GIT_DIR!)
$

//提交文件

单凯@shankai MINGW32 /e/gitRepository
$ cd git_init_1/

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ ls

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ clear

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ touch a

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ touch b

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git add a b

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   a
        new file:   b


单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git commit
a  b

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git commit -m "Initial commit"
[master (root-commit) b590d29] Initial commit
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a
 create mode 100644 b

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ vi a

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   a

no changes added to commit (use "git add" and/or "git commit -a")

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git add a
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git status
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   a


单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git commit -m "modified a"
[master warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
7e767db] modified a
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
 1 file changed, 7 insertions(+)

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$ git status
On branch master
nothing to commit, working directory clean

单凯@shankai MINGW32 /e/gitRepository/git_init_1 (master)
$
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值