将文件添加到Git版本库中

一、 创建一个测试文件(git_test_file)

[root@git git_test]# echo fuchao >git_test_file

二、 把测试文件添加到版本库的暂存区中

[root@git git_test]# git add git_test_file

三、 查看处于暂存区的文件

[root@git git_test]# git status

On branch master

Initial commit

Changes to be committed:

(use "git rm --cached ..." to unstage)

new file: git_test_file

[root@git git_test]#

四、讲文件添加到版本库

[root@git git_test]# git commit -m "Submission instructions" \

--author="fuchao [email protected]"
下面是命令输出:
[master (root-commit) 9cb4509] Submission instructions
Author: fuchao [email protected]
Committer: root
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email [email protected]

If the identity used for this commit is wrong, you can fix it with:

git commit --amend --author='Your Name '

1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 git_test_file
[root@git git_test]#

查看工作区的状态

[root@git git_test]# git status

On branch master

nothing to commit (working directory clean)

可以看到工作区现在是干净的了

你可能感兴趣的:(将文件添加到Git版本库中)