1.git 的初步使用
1. 安装
2. 使用 , 进入当前目录
3. 配置邮箱与用户名
git config --global user.email "121340751@qq.com" git config --global user.name "流浪"
git init 初始化
git clone url 克隆到本地
git add .
git commit --m “XXXX”
git remote add origin https://github.com/lifeload/new-problem.git
git push -u origin master 这时github上就会多出文件
git push -f origin master 在这里,如果报错,就强制性上传代码
Git 全局设置:
git config --global user.name "()「别来无恙」" git config --global user.email "longly1111@163.com"
创建 git 仓库: mkdir fm501 cd fm501 git init touch README.md git add README.md git commit -m "first commit" git remote add origin https://gitee.com/longly11/fm501.git git push -u origin "master"
已有仓库? cd existing_git_repo git remote add origin https://gitee.com/longly11/fm501.git git push -u origin "master"
简单教程 : https://blog.csdn.net/weixin_43560272/article/details/100011527
4. 使用测试
工作区
git init ->初始化文件
git status ->获取当前文件夹里面所有文件状态
git reset HEAD -> 由绿色区缓存区 退回 红色区域
git checkout --------> 由红色区域 退回 控制起来
缓存区
git add index.html -> 管理index.html文件
git add . -> 管理所有文件
git add ------> 暂存区 绿色区域
版本区
git commit -m '版本描述' -> 生成版本
查看版本记录
git log -> 浏览所有版本
版本回滚
git reset --head 版本号
回归已经去掉的版本
1.查看版本
git reflog - >查看所有版本, 包括已经去掉的版本
2. 然后再运行回滚
git reset --head 版本号
打开github 的方法
github 140.82.112.4 github.com 199.232.69.194 github.global.ssl.fastly.net
推送
git push