git --version 查看安装git版本信息
git config --global user.name wfy 设置用户名
git config --global user.email wfy@guigu.com 设置邮箱(虚假的,git不检查)
1.0初始化本地库:
1.在项目文件右击点击git bash here进入项目
2. 然后git init初始化
3.ll 查看当前目录;ll -a查看隐藏文件夹
4.cd .git/ 进入.git目录
2.0查看本地库:git status
1.vim hello.txt 创建hello.txt文件
2.摁下i,进入编译模式,完成后摁下esc+冒号+wq 退出并保存
3.yy复制;p粘贴
4.cat hello.txt 查看文件中内容
5.tail -n 1 hello.txt 查看文件末尾一行
3.0本地文件添加到暂存区:git add hello.txt
删除暂存区文件:git rm --cached hello.txt
4.0提交本地库:将暂存区文件提交到本地库形成历史版本
1.git commit -m "first commit" hello.txt
(git commit -m "版本名" 文件名)
2.git reflog 查看引用日志信息
3.git log 查看详细日志信息
5.0修改文件
1.vim hello.txt 进入文件 i 修改
2.esc+:+wq 保存并退出
3.追踪修改,git add hello.txt
4.提交:git commit -m "second commit" hello.txt
6.0版本穿梭
1.git reflog 查看版本号,复制要穿梭的版本号(包含当前所用版本)
2.git reset --hard 1687cfc 穿梭
(git reset --hard 版本号)