Files
Obsidian-Main/03. 資料收集/軟體工具/git/apply.md
Awin Huang 2f312a4575 vault backup: 2022-09-26 18:39:43
Affected files:
.obsidian/workspace
03. 資料收集/HTTP Server/Nginx.md
03. 資料收集/Hobby/RC.md
03. 資料收集/Hobby/模型/Traxxas Sledge.md
03. 資料收集/Hobby/模型/舊化作例.md
03. 資料收集/Hobby/軍武/虎式.md
03. 資料收集/Programming/COM/20210726 - COM Interface.md
03. 資料收集/Programming/DB/MySQL.md
03. 資料收集/Programming/DB/sqlite.md
03. 資料收集/Programming/Design Pattern.md
03. 資料收集/Programming/FFMPEG/00. Introduction.md
03. 資料收集/Programming/FFMPEG/01. Setup.md
03. 資料收集/Programming/FFMpeg.md
03. 資料收集/Programming/Flask.md
03. 資料收集/Programming/Media Foundation/20210604 - Windows media foundation.md
03. 資料收集/Programming/OpenCV.md
03. 資料收集/Programming/OpenGL.md
03. 資料收集/Programming/Python/argparse.ArgumentParser.md
03. 資料收集/Programming/Python/decorator.md
03. 資料收集/Programming/Python/logging.md
03. 資料收集/Programming/Python/opencv.md
03. 資料收集/Programming/Python/subprocess.md
03. 資料收集/Programming/Python/threading.md
03. 資料收集/Programming/Python/tkinter.md
03. 資料收集/Programming/Python/檢測工具.md
03. 資料收集/Programming/QT/Dropdown button.md
03. 資料收集/Programming/QT/QVariant.md
03. 資料收集/Programming/QT/Qt.md
03. 資料收集/Programming/Qt.md
03. 資料收集/Programming/UML.md
03. 資料收集/Programming/演算法.md
03. 資料收集/架站/03. Trojan.md
03. 資料收集/架站/Gitea.md
03. 資料收集/架站/HTTP Server/Apache.md
03. 資料收集/架站/HTTP Server/Nginx/Reverse Proxy(Layer4).md
03. 資料收集/架站/Pelican blog.md
03. 資料收集/架站/Proxmox VE.md
03. 資料收集/架站/SWAG Reverse proxy.md
03. 資料收集/架站/Storj.md
03. 資料收集/架站/Trojan.md
03. 資料收集/科技/802.11.md
03. 資料收集/科技/HDR Sensor.md
03. 資料收集/科技/量子電腦.md
03. 資料收集/科技/鋰電池.md
03. 資料收集/軟體工具/IPFS.md
03. 資料收集/軟體工具/MkDocs.md
03. 資料收集/軟體工具/Obsidian.md
03. 資料收集/軟體工具/docker.md
03. 資料收集/軟體工具/git/apply.md
03. 資料收集/軟體工具/git/submodule.md
2022-09-26 18:39:43 +08:00

36 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 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](https://stackoverflow.com/questions/14509950/my-diff-contains-trailing-whitespace-how-to-get-rid-of-it),透過加入 `--whitespace=warn``--whitespace=nowarn` 參數來解決。
- [^1]
[^1]: [(2018 iThome 鐵人賽) Day 11: 使用 Git 時如何做出跨 repo 的 cherry-pick - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天](https://ithelp.ithome.com.tw/articles/10194972)
### Trouble shooting
- 如果在Windows上git clone遇到例如`error: invalid path``fatal: unable to checkout working tree`
```
$ 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 :/'
```
有可能是因為檔名與NTFS規則有所衝突解法
```
cd <REPO_NAME>
git config core.protectNTFS false; git reset --hard HEAD
```