Administrator@User-14 MINGW64 /g/gitdemo (master)$ git logcommit 3e6b279f80f8496bcc7ffff73ab3d6e9727aeed3 (HEAD -> master)Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:31:35 2021 +0800second commit dc1a2afcb88674bd7ff34afe5d5ef9d93d2253b4Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:27:10 2021 +0800first =================显示信息简写===============Administrator@User-14 MINGW64 /g/gitdemo (master)$ git log --pretty=shortcommit 3e6b279f80f8496bcc7ffff73ab3d6e9727aeed3 (HEAD -> master)Author: Administrator <woodlum@vip.qq.com>second commit dc1a2afcb88674bd7ff34afe5d5ef9d93d2253b4Author: Administrator <woodlum@vip.qq.com>first==============查看指定文件的提交日志=============Administrator@User-14 MINGW64 /g/gitdemo (master)$ git log test.txtcommit 3e6b279f80f8496bcc7ffff73ab3d6e9727aeed3 (HEAD -> master)Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:31:35 2021 +0800second commit dc1a2afcb88674bd7ff34afe5d5ef9d93d2253b4Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:27:10 2021 +0800first==============查看文件的详细改动-p=============$ git log -p//或者git log -p test.txtcommit 3e6b279f80f8496bcc7ffff73ab3d6e9727aeed3 (HEAD -> master)Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:31:35 2021 +0800second diff --git a/test.txt b/test.txtindex e4a7dd9..f6ce845 100644--- a/test.txt+++ b/test.txt@@ -1 +1 @@-aaaaa//改动之前内容 No newline at end of file+aaaaabb//此处能看到内容变化 No newline at end of file commit dc1a2afcb88674bd7ff34afe5d5ef9d93d2253b4Author: Administrator <woodlum@vip.qq.com>Date:Wed Jan 6 11:27:10 2021 +0800first diff --git a/test.txt b/test.txtnew file mode 100644index 0000000..e4a7dd9--- /dev/null+++ b/test.txt@@ -0,0 +1 @@+aaaaa//此处能看到内容变化 No newline at end of file查看操作日志:git reflog
Administrator@User-14 MINGW64 /g/gitdemo (master)$ git reflogd76d79a (HEAD -> master, A) HEAD@{0}: reset: moving to d76d79ad76d79a (HEAD -> master, A) HEAD@{1}: reset: moving to d76d79a31a3585 HEAD@{2}: reset: moving to 31a3585d76d79a (HEAD -> master, A) HEAD@{3}: merge A: Fast-forward31a3585 HEAD@{4}: checkout: moving from A to masterd76d79a (HEAD -> master, A) HEAD@{5}: commit: a131a3585 HEAD@{6}: checkout: moving from master to A31a3585 HEAD@{7}: commit (initial): m1查看工作区和暂存区差异:git diff
//先修改test.txt文件内容Administrator@User-14 MINGW64 /g/gitdemo (master)$ git diffdiff --git a/test.txt b/test.txtindex f6ce845..4e7ce06 100644--- a/test.txt+++ b/test.txt@@ -1 +1 @@-aaaaabbNo newline at end of file+aaaaabbccc//文件内容改变之后的内容 No newline at end of file Administrator@User-14 MINGW64 /g/gitdemo (master)$ git add .//添加到暂存区后 , diff就没有差异了因此不会显示内容 Administrator@User-14 MINGW64 /g/gitdemo (master)$ git diff查看工作区与最新提交差异:git diff HEAD
//先修改test.txt文件内容Administrator@User-14 MINGW64 /g/gitdemo (master)$ git diff//工作区与暂存区差异diff --git a/test.txt b/test.txtindex 4e7ce06..9f67a57 100644--- a/test.txt+++ b/test.txt@@ -1 +1 @@-aaaaabbccc No newline at end of file+aaaaabbcccd No newline at end of file Administrator@User-14 MINGW64 /g/gitdemo (master)$ git add .//添加到暂存区后无差异Administrator@User-14 MINGW64 /g/gitdemo (master)$ git diff //工作区与最新提交的差异 , HEAD指向最新提交的记录Administrator@User-14 MINGW64 /g/gitdemo (master)$ git diff HEADdiff --git a/test.txt b/test.txtindex 4e7ce06..9f67a57 100644--- a/test.txt+++ b/test.txt@@ -1 +1 @@-aaaaabbccc No newline at end of file+aaaaabbcccd No newline at end of file四、分支操作git默认分支为master , 以此基础上创建不同的分支 , 由不可的开发人员进行修改 , 然后再进行合并到master分支 。分支有利于版本控制和团队协作 。
查看分支列表:git branch
Administrator@User-14 MINGW64 /g/gitdemo (master)$ git branch* master//分支名前带有*号表示当前所在的分支分支的创建与切换
以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!
「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助:- 抖音上传视频时间多久 抖音发视频长时间是多少
- 为什么上传头像失败:手机上传报名照片失败,常见问题及解决方法总结
- 给文件夹直接加密步骤 怎么给磁盘加密码
- 缓存视频合并工具app推荐 苹果手机缓存变成本地视频
- 字体在电脑c盘的位置 电脑里的字体一般文件夹在哪里
- 苹果用户都艳羡的功能?ColorOS 12属实把本地化服务玩明白了
- 办公室两台电脑共享文件的方法 电脑共享文件夹无法访问
- 共享服务器搭建方案 公司共享文件夹的建立
- 教你查看电脑中的隐藏文件 win7打开隐藏的文件夹
- 前端获取上传文件路径 formdata上传文件附加参数