這是本文件的舊版!
Git 命令列操作整理
FAQ
1. 讓本地端同步刪除遠端已不存在的分支
- 透過 git branch -a 可以看到有 remotes/origin/分支 Exp.
main * master remotes/origin/main remotes/origin/master
- 如果在遠端已經遺除掉 main 分支, 要想讓本地端的 remotes/origin/main 可以同步消失, 可以使用 git fetch –prune 來達成
> git fetch --prune From https://gitlab.cloudlab.iiidevops.org/local-templates/cloudlab2024-02 - [deleted] (none) -> origin/main
2. 合併分支檔案衝突批次處理
- 假設由 develop 分支合併入 master 後一些檔案出現衝突, 希望完全依照 develop 的版本為主
- 在 repo 目錄執行
git checkout --theirs . - 然後執行:
git add .和
git commit