1,开始时分支状态:
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git branch
* master
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git branch -r
origin/master
2,添加内容:新增文件,commit:add,然后push到github上
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ touch .gitignore
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git push origin master
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git log
commit 6e90dafdaa1c56b8ac101809328c354b7faee9a5 ( HEAD -> master, origin/master)
Author: XXXX < XXXX@qq.com>
Date: Fri May 5 17 :18:31 2023 +0800
add
commit 636302a42e210e87166241487697afc4be8f9e66
Author: XXXX < XXXX@qq.com>
Date: Fri May 5 17 :01:43 2023 +0800
first commit
3,将本地仓库游标重置到 first commit:想将第二次的commit 信息更改(add ->add .gitignore)
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git reset --soft -q 636302a42e210e87166241487697afc4be8f9e66
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git log
commit 636302a42e210e87166241487697afc4be8f9e66 ( HEAD -> master)
Author: XXXX < XXXX@qq.com>
Date: Fri May 5 17 :01:43 2023 +0800
first commit
4,重新设置新的commit 信息
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)
$ git commit -m "add .gitignore"
[ master 0df075e] add .gitignore
1 file changed, 2 insertions( +)
create mode 100644 .gitignore
5,但是不能push
Ju@LAPTOP-M0AFG6V3 MINGW64 ~/Desktop/测试笔记/testgit ( master)