Git踩坑指南

2020-10-09 21:51:22

what:是什么

一些场景的避开坑的命令

  • git fetch

  • git rebase

  • git rm

why:为什么用

实际的应用场景有哪些?

  • 实时更新最新的代码

    • git fetch master

  • 代码冲突,需要回滚

    • git rebase

  • 多人协作开发过程中,突然修复了一个bug

    • git rebase

  • 切换属于自己的分支

    • git checkout

  • 合并代码

    • git merge master

  • 查看日志

    • git log

  • 查看某个文件的修改

    • git blame xx.file

  • 查看当前的状态

    • git status

  • cherry -pick??

    • 将分支一修改的代码合并到分支二中

  • 将修改的代码放到暂存区,运行之前无任何修改的代码

    • git stash

  • 追加修改内容到上一个提交信息

    • git commit --amend

  • git 查看帮助

    • git / git commit --help

how:怎么用

  • 冲突如何解决

图片

快速查找手册:

https://www.git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%8E%B7%E5%8F%96-Git-%E4%BB%93%E5%BA%93

图形界面工具:fork

https://git-fork.com/

Last updated

Was this helpful?