05. Create a new file and submit it to the local git repository

## view the current status of Git

[root@node31 git_test]# git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)

 

## Create a new file, take a look at the state of

[root@node31 git_test]# touch chenliang.txt
[root@node31 git_test]# ll chenliang.txt 
-rw-r--r-- 1 root root 0 Feb 19 07:25 chenliang.txt
[root@node31 git_test]# 
[root@node31 git_test]# git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	chenliang.txt
nothing added to commit but untracked files present (use "git add" to track)

 

## let chenliang.txt files are tracked by git

[root@node31 git_test]# git add chenliang.txt 
[root@node31 git_test]# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#	new file:   chenliang.txt
#
[root@node31 git_test]#

 

 ## will be submitted to the staging area in the file to a local warehouse

[root@node31 git_test]# git commit -m "empty file chenliang.txt"
[master (root-commit) 94902bc] empty file chenliang.txt
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 chenliang.txt

 

## and then look at the status of git

[root@node31 git_test]# git status
# On branch master
nothing to commit, working directory clean

 

Guess you like

Origin www.cnblogs.com/chenliangc/p/12329676.html