常见GIT面试整理

83 阅读1分钟
  1. git init 初始化git文件
  2. git config --list 查看配置
  3. git config user.name 用户名
  4. git config user.email 邮箱
  5. git config --global user.name newname 修改用户名
  6. git config --global user.email newemail 修改邮箱名
  7. git log 查看版本信息
  8. git reflog 查看所有版本信息
  9. git reflog --pretty=oneline 查看所有版本回退信息
  10. git status 查看状态
  11. git reset --hard HEAD^ 回退代码
  12. git reset --hard commit_id 回退到某个版本
  13. git clone 克隆代码
  14. git add . 保存代码到暂存区
  15. git commit -m 'xxx' 提交commit
  16. git commit --amend 只保留一次提交记录
  17. git checkout master 切到主分支上 + git merge(合并分支)
  18. git push -u origin master 下次即可使用19个指令
  19. git push -f origin master 强推代码到仓库
  20. git branch -d branchname 删除
  21. git branch -n name1 name2 修改名称
  22. git checkout -b branchname 创建新的分支且切换到该分支
  23. git rebase -i commit_id 合并commit为一条
  24. git rebase --continue 合并冲突
  25. git rebase --abort 放弃冲突
  26. git rebase --skip 千万不能使用跳过冲突
  27. git fetch 【remote】下载远程仓库所有变动
  28. git remote add origin【url】增加远程仓库命名
  29. git push -u origin master 推代码到master

借鉴文章: blog.csdn.net/halaoda/art…