git使用总结

git配置

  1. git config --global user.name '张三'

  2. git config --global user.email 'xx@163.com'

git常用指令

  1. git init初始化仓库

  2. git add ./添加

  3. git commit -m '新增vss文件'

  4. git status查看状态

  5. git log && git log --oneline && git reflog查看提交日志

  6. git reset --hard 版本号 回退到指定版本

  7. git pull 仓库地址 master && git push 仓库地址 master

  8. git clone 仓库地址

分支

  1. git branch 分支名字创建分支

  2. git branch查看分支

  3. git checkout 分支名字切换分支

  4. git branch -d 分支名字

工作中操作流程

  1. git clone 仓库地址克隆远程仓库

  2. git add ./ && git add *添加

  3. git commit -m '提交说明信息' 提交到本地仓库

  4. git push 推送到远程仓库

其他

  1. 早上去第一件事 git pull 拉取最新仓库代码

  2. 晚上下班之前 git push将一天做的所有代码提交到远程仓库

原文地址:https://www.cnblogs.com/handsome-boy/p/9336992.html