跳转至

5. git版本提交流程

4. git版本提交流程

1.生成git工作区/cp_git/git03

[root@chupeng cp_git]# ls
git00  git01  git02
[root@chupeng cp_git]# git init /cp_git/git03
Initialized empty Git repository in /cp_git/git03/.git/

2.查看git本地仓库

[root@chupeng cp_git]# cd git03
[root@chupeng git03]# ls -a
.  ..  .git
[root@chupeng git03]# tree .git/
.git/
├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   └── update.sample
├── info
│   └── exclude
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

9 directories, 13 files

3.查看工作区信息

[root@chupeng git03]# ls -a
.  ..  .git
[root@chupeng git03]# git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)

4.在工作区创建文件

[root@chupeng git03]# touch a_v1 b_v1
[root@chupeng git03]# ls
a_v1  b_v1
[root@chupeng git03]# git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       a_v1
#       b_v1
nothing added to commit but untracked files present (use "git add" to track)

5.确认添加

[root@chupeng git03]# git add .
[root@chupeng git03]# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   a_v1
#       new file:   b_v1
#

6.提交到本地仓库

[root@chupeng git03]# git commit -m "第一版的注释信息"
[master (root-commit) 3679d4b] 第一版的注释信息
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a_v1
 create mode 100644 b_v1
[root@chupeng git03]# git status
# On branch master
nothing to commit, working directory clean

7.再次查看git本地仓库

[root@chupeng git03]# tree .git/
.git/
├── branches
├── COMMIT_EDITMSG
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   └── update.sample
├── index
├── info
│   └── exclude
├── logs
│   ├── HEAD
│   └── refs
│       └── heads
│           └── master
├── objects
│   ├── 36
│   │   └── 79d4ba2bd30b3b2c48c0c6364ce5f1c901cb88
│   ├── d5
│   │   └── a35b5daf3ba7c3521eb5e9ab5a50961057f4b4
│   ├── e6
│   │   └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   ├── info
│   └── pack
└── refs
    ├── heads
    │   └── master
    └── tags

15 directories, 21 files

最后更新: 2022-02-18 11:26:47