1.8 KiB
1.8 KiB
apply
git diff 生出一個 diff 檔,而 git apply 把這個 diff 檔 apply 到某個 branch 上。
git diff ${A_COMMIT_HASH} ${B_COMMIT_HASH} > xxx.patch
git apply xxx.patch
- 如果在
git apply的過程中遇到 trailing whitespace error 的話,可以參考這篇文章:git - My diff contains trailing whitespace - how to get rid of it? - Stack Overflow,透過加入--whitespace=warn或--whitespace=nowarn參數來解決。 - 1
Trouble shooting
- 如果在Windows上git clone遇到,例如:
error: invalid path、fatal: unable to checkout working tree有可能是因為檔名與NTFS規則有所衝突,解法:$ gclogi git@github.com-logi:LogiVideoFW/VC_Bolide_TableHub.git Cloning into 'VC_Bolide_TableHub'... remote: Enumerating objects: 159, done. remote: Counting objects: 100% (159/159), done. remote: Compressing objects: 100% (134/134), done. remote: Total 85001 (delta 71), reused 84 (delta 21), pack-reused 84842 Receiving objects: 100% (85001/85001), 599.21 MiB | 6.18 MiB/s, done. Resolving deltas: 100% (17824/17824), done. error: invalid path 'zynqLNX/kernel-source/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c' fatal: unable to checkout working tree warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'cd <REPO_NAME> git config core.protectNTFS false; git reset --hard HEAD