Git命令学习第五天

#创建一个文件

[root@MiWiFi-R3A-srv git_practice1]# touch myfile.txt

[root@MiWiFi-R3A-srv git_practice1]# ls -a

.  ..  .git  hhh  myfile.txt

#将该文件添加到暂缓区

[root@MiWiFi-R3A-srv git_practice1]# git add myfile.txt

#观察此时文件的情况

[root@MiWiFi-R3A-srv git_practice1]# git status

On branch master

Initial commit

Changes to be committed:

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

new file:  myfile.txt

#将暂存区的myfile.txt进行commit,并填写commit信息

[root@MiWiFi-R3A-srv git_practice1]# git commit

[master (root-commit) 6d62ce2] commit myfile.txt

1 file changed, 0 insertions(+), 0 deletions(-)

create mode 100644 myfile.txt

[root@MiWiFi-R3A-srv git_practice1]# git tag

#查看commit命令

[root@MiWiFi-R3A-srv git_practice1]# git log

commit 6d62ce28743ee47ba7073674c812ec077044fa4c

Author: yongfengnice <[email address]>

Date:  Mon Apr 13 01:33:04 2020 +0800

    commit myfile.txt

#新建一个tag在当前commit

[root@MiWiFi-R3A-srv git_practice1]# git tag hhh

#列出所有的tag

[root@MiWiFi-R3A-srv git_practice1]# git tag

hhh

[root@MiWiFi-R3A-srv git_practice1]# git tag xxx myfile

fatal: Failed to resolve 'myfile' as a valid ref.

[root@MiWiFi-R3A-srv git_practice1]# git tag del

[root@MiWiFi-R3A-srv git_practice1]# git tag

del

hhh

#删除本地tag

[root@MiWiFi-R3A-srv git_practice1]# git tag -d del

Deleted tag 'del' (was 6d62ce2)

[root@MiWiFi-R3A-srv git_practice1]# git tag

hhh


遇到一个问题:不能新建一个tag去指定commit

错误提示:fatal: Failed to resolve 'myfile.txt' as a valid ref.

(致命:未能解决'myfile。作为有效的参考。)

你可能感兴趣的:(Git命令学习第五天)