- git init 初始化git文件
- git config --list 查看配置
- git config user.name 用户名
- git config user.email 邮箱
- git config --global user.name newname 修改用户名
- git config --global user.email newemail 修改邮箱名
- git log 查看版本信息
- git reflog 查看所有版本信息
- git reflog --pretty=oneline 查看所有版本回退信息
- git status 查看状态
- git reset --hard HEAD^ 回退代码
- git reset --hard commit_id 回退到某个版本
- git clone 克隆代码
- git add . 保存代码到暂存区
- git commit -m 'xxx' 提交commit
- git commit --amend 只保留一次提交记录
- git checkout master 切到主分支上 + git merge(合并分支)
- git push -u origin master 下次即可使用19个指令
- git push -f origin master 强推代码到仓库
- git branch -d branchname 删除
- git branch -n name1 name2 修改名称
- git checkout -b branchname 创建新的分支且切换到该分支
- git rebase -i commit_id 合并commit为一条
- git rebase --continue 合并冲突
- git rebase --abort 放弃冲突
- git rebase --skip 千万不能使用跳过冲突
- git fetch 【remote】下载远程仓库所有变动
- git remote add origin【url】增加远程仓库命名
- git push -u origin master 推代码到master
借鉴文章: blog.csdn.net/halaoda/art…