当前目录下创建新仓库
git init gitlearning

进入目录
cd gitlearning

配置仓库user.name user.email

git config --local user.name 'lula'
git config --local user.email 'admin@coding.lula.fun'

创建README.md
touch README.md

尝试commit
git commit -m'Add readme'

报错,因为还没有track该文件

On branch master

Initial commit

Untracked files:
    README.md

nothing added to commit but untracked files present

add
git add README.md

查看当前的状态
git status

On branch master

No commits yet

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

    new file:   README.md

重新commit
git commit -m'Add README.md'
成功

[master (root-commit) 9a4b5ae] Add README.md
 1 file changed, 112 insertions(+)
 create mode 100644 README.md

查看git日志
git log

commit 9a4b5aefbf519f1c3cc9939321cb62721d8889d8 (HEAD -> master)
Author: lula <admin@coding.lula.fun>
Date:   Sun Jul 12 10:37:26 2020 +0800

    Add README.md
最后修改:2021 年 02 月 05 日
如果觉得我的文章对你有用,请随意赞赏