场景1: 需要查询某次提交改动了哪些文件以及文件改动的行数。
git log -n1 commit1 --stat
场景2: 工作区里很多修改,此时需要得到工作区和仓库的内容一致。
git checkout .
场景3: 在imx8x_p搜索某个人提交
parentproject:Android/imx8x_p owner:liiyuan
场景4: repo synnc
报下面错误:
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
fatal: ssh 变体 'simple' 不支持设置端口
error: Cannot fetch platform/external/jemalloc
Fetching project platform/external/google-breakpad
warn: external/google-breakpad: Not replacing locally modified commit-msg hook
fatal: ssh 变体 'simple' 不支持设置端口
error: Cannot fetch platform/external/jsr330
error: Cannot fetch device/generic/car
error: Cannot fetch platform/external/flatbuffers
fatal: ssh 变体 'simple' 不支持设置端口
解决办法:
git config --global ssh.variant ssh
repo使用
场景1: 拉取仓库所有代码,并切换到 android-9.0.0_r12分支。
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r12
repo sync(把所有分支代码都拉取下来)
repo sync -dcq(只拉取android-9.0.0_r12分支)
场景2: 在repo sync后,切换到android-10.0.0_r2。
repo forall -c git checkout android-10.0.0_r2
场景3: 查看repo仓库下有哪些分支
1. 切换到 .repo/manifests目录
2. 输入命令: git branch -a
参考:
彻底搞懂 Git-Rebase